Ivan V. wrote:
> Hi,
> 
> I'm trying to pinpoint what the issue might be here. In a controller
> that has the appropriate layout (layouts/controller.html.erb), if I try
> to override the layout to the 'application' layout only for certain
> actions, those actions do get rendered with the application layout...
> Like this:
> 
> layout 'application', :only => :new
> 
> The 'new' action renders fine, but now the other actions don't render at
> all!
> 
> No error or anything, just an empty response. I've tried renaming the
> layout files to see if an error shows up, and no error (so no layout is
> being picked up).
> 
> On my views I have content_for, so since nothing is yielding those
> contents, nothing shows up. If I put something outside a content_for, it
> does show up (without a layout of course).
> 
> If I explicitly render the layout on the action, it works, like so:
> 
> render :layout => 'somelayout'
> 
> So what's the deal here?
> 
> Thanks in advance!


Try this instead: specify a default controller-wide layout, and then 
action-specific layouts defined within the action itself via render.

class MyController < ActionController::Base
    layout "default_layout"

    def foo
      render :action => "foo", :layout => "foo_layout"
    end
end

http://api.rubyonrails.org/classes/ActionController/Layout/ClassMethods.html#M000301
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to