Hallo phorum, i have custom rest action. routes.rb: map.resources :schools, :collection => { :graduations => :get } SchoolsController: def graduations @schools = School.graduation(true) end link somewhere in navigation: <%= link_to ''Schools with graduation'', graduations_schools_path %> All works OK for me, but Rails needs (of course) a template for controller action ''graduations'': Template is missing Missing template schools/graduations.erb in view path blah blah blah... But i need to use the template ''index.html.erb'' instead of the new template ''graduations.html.erb''... How to do this in Schools controller? thanks, -- Pavel Krusek pavel.krusek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Pavel Krusek wrote:> Hallo phorum, > > i have custom rest action. > > routes.rb: > map.resources :schools, :collection => { :graduations => :get } > > SchoolsController: > def graduations > @schools = School.graduation(true) > end > > link somewhere in navigation: > <%= link_to ''Schools with graduation'', graduations_schools_path %> > > > All works OK for me, but Rails needs (of course) a template for > controller action ''graduations'': > > Template is missing > > Missing template schools/graduations.erb in view path blah blah blah... > > But i need to use the template ''index.html.erb'' instead of the new > template ''graduations.html.erb''... > > How to do this in Schools controller? > thanks, > > -- > Pavel Krusek > > pavel.krusek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.orgclass SchoolsController: layout ''mynewlayout'' def graduations end . . And it will use your custom layout called mynewlayout Hope this helps. Petr ;) (BTW: čus) -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, i thought the template for concrete action 'graduations', no template for layout. Solution: def graduations @schools = School.graduation(true) render :action => "index" end I forgot direction 'render' ;) Thanks, Pavel Zdar :) 2008/12/14 Petr Bobek <rails-mailing-list@andreas-s.net>:> > Pavel Krusek wrote: >> Hallo phorum, >> >> i have custom rest action. >> >> routes.rb: >> map.resources :schools, :collection => { :graduations => :get } >> >> SchoolsController: >> def graduations >> @schools = School.graduation(true) >> end >> >> link somewhere in navigation: >> <%= link_to 'Schools with graduation', graduations_schools_path %> >> >> >> All works OK for me, but Rails needs (of course) a template for >> controller action 'graduations': >> >> Template is missing >> >> Missing template schools/graduations.erb in view path blah blah blah... >> >> But i need to use the template 'index.html.erb' instead of the new >> template 'graduations.html.erb'... >> >> How to do this in Schools controller? >> thanks, >> >> -- >> Pavel Krusek >> >> pavel.krusek@gmail.com > > class SchoolsController: > layout 'mynewlayout' > > def graduations > end > . > . > > And it will use your custom layout called mynewlayout > > > Hope this helps. > Petr ;) > (BTW: čus) > -- > Posted via http://www.ruby-forum.com/. > > > >-- Pavel Krusek +420 602 641 039 irb(main):001:0> ( 'pavel.krusekATgmail._see_om'.gsub('_see_', 'c').gsub('AT', '@') ) --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---