perhaps a before or after filter to set it based on
controller.action_name ?
On Nov 11, 7:18 pm, Jason Pfeifer
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Greetings,
>
> I''m wondering if I can do action specific layouts in an elegant
way like
> this:
>
> class AuthorsController < ApplicationController
> before_filter :is_admin?, :only => [:new, :create, :edit, :update,
> :destroy]
>
> layout "admin", :except => [:index, :show]
>
> make_resourceful do
> actions :index, :show, :new, :create, :edit, :update
> end
>
> end
>
> I''m aware that you can do it in each action with:
>
> def index
> render :layout => "layout"
> end
>
> However, in a need to keep it clean I don''t want to write that.
Looking
> at the layout method source, it appears that it should accept options.
> However, if I set :only or :except the layout is only correctly
"admin"
> for the ones specified (or excepted), and the others render without a
> layout.
>
> Thoughts?
>
> Thanks,
>
> Jason
> --
> Posted viahttp://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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---