How could I use the layout of a different controller?
Thanks
How could I use the layout of a different controller?
Thanks
Hubert ÅÄ™picki wrote:
class MyController < ActionController::Base
layout “myotherlayout”
…
endwill use app/view/layouts/myotherlayout.html.erb file
Sweet, seems like that works, but in my layout I’m rendering partials
that are in a different controller as well, how do I go about that?
Thanks
class MyController < ActionController::Base
layout “myotherlayout”
…
end
will use app/view/layouts/myotherlayout.html.erb file
Justin To wrote:
Hubert ÅÄ™picki wrote:
class MyController < ActionController::Base
layout “myotherlayout”
…
endwill use app/view/layouts/myotherlayout.html.erb file
Sweet, seems like that works, but in my layout I’m rendering partials
that are in a different controller as well, how do I go about that?Thanks
In the layout, instead of saying
<%= render :partial => ‘apple_partial’ %>
use this instead:
<%= render :partial => ‘apples/apple_partial’ %>
where “apples” is the name of the view folder that the partial is in.
HTH,
Joe
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs