I created a controller called reports, for which I didn''t have any model or tables. I wanted to use a menu/layout structure similar to all my other models/controllers and added a layout named reports which then gives me the menu/layout structure but is also now part of all my reports. That isn''t gonna work so I renamed reports.rhtml to reports_forms.rhtml (still inside my layouts directory) and then I created a model called report.rb and inside it... def forms render :action => "forms", :layout :=> "reports_forms" def but that doesn''t work either. How can I have a controller or view that selectively uses a layout? Craig
>How can I have a controller or view that selectively uses a layout? > >Craig >http://api.rubyonrails.org/classes/ActionController/Layout/ClassMethods.html Mikkel Bruun www.strongside.dk - Football Portal(DK) nflfeed.helenius.org - Football News(DK) ting.minline.dk - Buy Old Stuff!(DK) -- Posted with http://DevLists.com. Sign up and save your time!
On Thu, 2006-02-23 at 12:46 +0000, Mikkel Bruun wrote:> >How can I have a controller or view that selectively uses a layout? > > > >Craig > > > > http://api.rubyonrails.org/classes/ActionController/Layout/ClassMethods.html---- I have been looking at that page and recited the changes I made after looking at that page and can''t figure it out. Thanks Craig
Use the "layout" method at the top of your controller. layout "layout-name". For example: layout "admin" On 2/23/06, Craig White <craigwhite@azapple.com> wrote:> > On Thu, 2006-02-23 at 12:46 +0000, Mikkel Bruun wrote: > > >How can I have a controller or view that selectively uses a layout? > > > > > >Craig > > > > > > > > http://api.rubyonrails.org/classes/ActionController/Layout/ClassMethods.html > ---- > I have been looking at that page and recited the changes I made after > looking at that page and can''t figure it out. > > Thanks > > Craig > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060223/a81791f1/attachment.html
That works the same as if I have a layout with the same name as the controller - I am trying to selectively have a layout in some methods in my reports_controller (the screen forms), but not on those that are destined to be printed. Craig On Thu, 2006-02-23 at 14:01 +0000, Doug Bromley wrote:> Use the "layout" method at the top of your controller. layout > "layout-name". > For example: layout "admin" > > On 2/23/06, Craig White <craigwhite@azapple.com> wrote: > On Thu, 2006-02-23 at 12:46 +0000, Mikkel Bruun wrote: > > >How can I have a controller or view that selectively uses a > layout? > > > > > >Craig > > > > > > > > http://api.rubyonrails.org/classes/ActionController/Layout/ClassMethods.html > ---- > I have been looking at that page and recited the changes I > made after > looking at that page and can''t figure it out. > > Thanks > > Craig > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
I got it...if I use render :action => "forms", :layout => "reports_forms" as the very last line in the method, it all works Thanks Craig On Thu, 2006-02-23 at 07:12 -0700, Craig White wrote:> That works the same as if I have a layout with the same name as the > controller - I am trying to selectively have a layout in some methods in > my reports_controller (the screen forms), but not on those that are > destined to be printed. > > Craig > > On Thu, 2006-02-23 at 14:01 +0000, Doug Bromley wrote: > > Use the "layout" method at the top of your controller. layout > > "layout-name". > > For example: layout "admin" > > > > On 2/23/06, Craig White <craigwhite@azapple.com> wrote: > > On Thu, 2006-02-23 at 12:46 +0000, Mikkel Bruun wrote: > > > >How can I have a controller or view that selectively uses a > > layout? > > > > > > > >Craig > > > > > > > > > > > > http://api.rubyonrails.org/classes/ActionController/Layout/ClassMethods.html > > ---- > > I have been looking at that page and recited the changes I > > made after > > looking at that page and can''t figure it out. > > > > Thanks > > > > Craig > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails