Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ROR 3 - Specifying specific view file, ignoring application layout

I would like to specify a specific view file to render instead of the default one corresponding the REST architecture, meaning out of my 'create' function in the controller I would like to invoke the 'new' view file - which I believe can be done using:

def create
 .
 .
 render :new
end

But I also need that view file to ignore the cross-site layout specified in layouts/application.html.erb? is there a way to do that?

If it was out of the 'new' function, I could just state "render :layout => false" .. but I need it out of the 'create'

is there something like:

render :new, layout => false

Thanks!

like image 376
StackAccount Avatar asked Aug 22 '26 23:08

StackAccount


2 Answers

Another way is this:

render :template => :new, :layout => false
like image 73
Vlad Khomich Avatar answered Aug 25 '26 21:08

Vlad Khomich


I' not sure about that, would have to try it, but i think that you can do this :

layout 'application', :except => :action_name

to exclude the action in your controller.

EDIT : I just tried it, it works indeed :)

like image 27
Spyros Avatar answered Aug 25 '26 23:08

Spyros