Hey all, I find this in ruby guide: resources :photos do collection do get ''search'' end end It will also create the search_photos_url and search_photos_path route helpers. So I try to implement: #routes resources :core do collection do get ''coreim'' get ''corer'' end end #index.html.haml = link_to ''core'', coreim_core_path I get undefined method coreim_core_path Thanks for response -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Phil On Wed, Mar 30, 2011 at 10:45 AM, John Merlino <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hey all, > > I find this in ruby guide: > > resources :photos do > collection do > get ''search'' > end > end > It will also create the search_photos_url and search_photos_path route > helpers. > > So I try to implement: > > #routes > resources :core do > collection do > get ''coreim'' > get ''corer'' > end > end > > #index.html.haml > = link_to ''core'', coreim_core_path > > I get undefined method coreim_core_path >run ''rake routes'' on the command line to see the routes that were created.> > Thanks for response > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Excerpts from John Merlino''s message of Wed Mar 30 08:45:50 -0700 2011:> So I try to implement: > > #routes > resources :core do > collection do > get ''coreim'' > get ''corer'' > end > endWith that routes file: $ rake routes coreim_core_index GET /core/coreim(.:format) {:action=>"coreim", :controller=>"core"} core_index GET /core(.:format) {:action=>"index", :controller=>"core"} POST /core(.:format) {:action=>"create", :controller=>"core"} new_core GET /core/new(.:format) {:action=>"new", :controller=>"core"} edit_core GET /core/:id/edit(.:format) {:action=>"edit", :controller=>"core"} core GET /core/:id(.:format) {:action=>"show", :controller=>"core"} PUT /core/:id(.:format) {:action=>"update", :controller=>"core"} DELETE /core/:id(.:format) {:action=>"destroy", :controller=>"core"} So you would have +coreim_core_index_path+, for example. This rather surprised me, since I had the same expectations as you. Further investigation suggestions inflections are to blame. # config/routes.rb # Note that we changed the resource to a pluralized form: "cores" instead of "core". resources :cores do collection do get ''coreim'' get ''corer'' end end $rake routes coreim_cores GET /cores/coreim(.:format) {:action=>"coreim", :controller=>"cores"} cores GET /cores(.:format) {:action=>"index", :controller=>"cores"} POST /cores(.:format) {:action=>"create", :controller=>"cores"} new_core GET /cores/new(.:format) {:action=>"new", :controller=>"cores"} edit_core GET /cores/:id/edit(.:format) {:action=>"edit", :controller=>"cores"} core GET /cores/:id(.:format) {:action=>"show", :controller=>"cores"} PUT /cores/:id(.:format) {:action=>"update", :controller=>"cores"} DELETE /cores/:id(.:format) {:action=>"destroy", :controller=>"cores"} -- med vänlig hälsning David J. Hamilton -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Excerpts from David J. Hamilton''s message of Wed Mar 30 09:22:01 -0700 2011:> This rather surprised me, since I had the same expectations as you. Further > investigation suggestions inflections are to blame.suggestions → suggests. -- med vänlig hälsning David J. Hamilton -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Thanks for response, it outputs this: coreim_core_index GET /core /coreim(.:format) {:action=>"coreim", :controller=>"core"} corer_core_index GET /core/corer(.:format) {:action=>"corer", :controller=>"core"} So I would expect this to work: coreim_core_path corer_core_path But neither does. This doesn''t work either: coreim_core_index corer_core_index -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> $rake routes > coreim_cores GET /cores/coreim(.:format) {:action=>"coreim", > :controller=>"cores"} > cores GET /cores(.:format) {:action=>"index", > :controller=>"cores"}ah, thanks for response. I didnt see this message on my last response. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Phil On Wed, Mar 30, 2011 at 11:30 AM, John Merlino <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Thanks for response, it outputs this: > > coreim_core_index GET /core > /coreim(.:format) {:action=>"coreim", > :controller=>"core"} > corer_core_index GET /core/corer(.:format) > {:action=>"corer", :controller=>"core"} > > So I would expect this to work: > > coreim_core_path > corer_core_path > > But neither does. This doesn''t work either: > > coreim_core_index > corer_core_index >For the record, if rake routes gives you the name coreim_core_index, then the named route will be coreim_core_index_path or coreim_core_index_url.... not just coreim_core_index by itself. If you''re changing the route names, that may not matter. :-)> > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.