Ben Johnson wrote:> Here is a simple example that really has no real world use, but helps
> illustrate what I''m trying to do:
>
> Let''s say you have a before filter that sets a variable @popup =
true.
> In your RHTML layout if @popup is true you pop up a window. I want to do
> the same with RJS calls, if @popup is true pop up a window via
> javascript. The problem is that I have to include this check in EVERY
> RJS template I have. A layout for RJS template would be optimal. Is this
> possible?
>
> I just want to use a layout with RJS template just as you would with
> RHTML template.
>
> Thanks for your help.
Just for other people viewing this, this worked...
@@exempt_from_layout = Set.new
I added that to the top of my applciation controller. Since
ActionController initializes it with rjs. Then I put this in my
determine layout method
def determine_layout
if request.xhr?
"default.rjs"
else
"default.rhtml"
end
end
Kind of a hack, but its the only thing I could get to work.
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---