routes.rb map.namespace :admin do |admin| admin.resources :cupcakes end rake routes cupcakes GET /cupcakes formatted_cupcakes GET /cupcakes.:format POST /cupcakes POST /cupcakes.:format That said, what the heck goes here: form_for(:cupcake, @cupcake, xxx_url) # ??? Calling create_admin_cupcake_url yields... undefined local variable or method ''create_admin_cupcake_url'' Additionally, calling form_for(@cupcake) yields... undefined method ''cupcake_path'' Finally, I''ve also tried... form_for(:cupcake, @cupcake, admin_cupcake_url, :method => :put) Which points to this URL: /admin/cupcakes/1/edit And gives me this view: Unknown action No action responded to 1 Routing and URL helpers (what do I use when?) have been the biggest barrier to creating a RESTful app. I''ve watched the Railscasts video and read the 2.0 release notes, and yes, the new stuff sure looks tasty, but it''s useless if I can''t get it 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 -~----------~----~----~----~------~----~------~--~---
Try: form_for([:admin, @cupcake]) -- 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 -~----------~----~----~----~------~----~------~--~---
Gerjan Stokkink wrote:> Try: > > form_for([:admin, @cupcake])Wow. It worked. Where''s the documentation for that? Thank you so much, Gerjan. You''re a life-saver. -- 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 -~----------~----~----~----~------~----~------~--~---
Daniel Waite wrote:> Gerjan Stokkink wrote: >> Try: >> >> form_for([:admin, @cupcake]) > > Wow. It worked. Where''s the documentation for that?http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M000907 -- 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 -~----------~----~----~----~------~----~------~--~---
> > form_for(:cupcake, @cupcake, admin_cupcake_url, :method => :put) >By the way, that didn''t work because you forgot to supply the cupcake id to the admin_cupcake_url helper. It should''ve been: form_for(:cupcake, @cupcake, admin_cupcake_url(@cupcake), :method => :put) -- 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 -~----------~----~----~----~------~----~------~--~---
Gerjan Stokkink wrote:> Daniel Waite wrote: >> Wow. It worked. Where''s the documentation for that? > > http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M000907Hmm, the only hint I see there is the parameter name, record_or_name_or_array, so I''m not sure how you deduced the solution, but whatever works. :) -- 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 -~----------~----~----~----~------~----~------~--~---
Straight from the docs (last entry under "Relying on record identification"): [QUOTE] And for namespaced routes, like admin_post_url: <% form_for([:admin, @post]) do |f| %> ... <% end %> [/QUOTE] -- 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 -~----------~----~----~----~------~----~------~--~---
Gerjan Stokkink wrote:>> >> form_for(:cupcake, @cupcake, admin_cupcake_url, :method => :put) >> > > By the way, that didn''t work because you forgot to supply the cupcake id > to the admin_cupcake_url helper. It should''ve been: > > form_for(:cupcake, @cupcake, admin_cupcake_url(@cupcake), :method => > :put)Nay. Although, true, in my example I didn''t pass @cupcake to the _url method, I have indeed tried it, and the result is the same as if I did not pass it. form_for(:cupcake, @cupcake, admin_cupcake_url(@cupcake), :method => :put) Yields this URL for form:action... /admin/cupcakes/1/edit With no additional field for the HTTP method. Again the view is the weird: Unknown action No action responded to 1> Straight from the docs (last entry under "Relying on record > identification"):Sure enough. That''s what I get for scanning through the documentation. Good to know it''s there... :) -- 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 -~----------~----~----~----~------~----~------~--~---
Daniel Waite wrote:> Gerjan Stokkink wrote: >>> >>> form_for(:cupcake, @cupcake, admin_cupcake_url, :method => :put)This is actually the correct form: form_for(:cupcake, @cupcake, admin_cupcake_url(@cupcake), :html => { :method => :put }) Even so, I still get the same form:action URL (edit instead of update) and the rendered view complains of an unknown action ''1''. -- 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 -~----------~----~----~----~------~----~------~--~---
Daniel Waite wrote:> > Nay. Although, true, in my example I didn''t pass @cupcake to the _url > method, I have indeed tried it, and the result is the same as if I did > not pass it. > > form_for(:cupcake, @cupcake, admin_cupcake_url(@cupcake), :method => > :put)Hmm, try this: form_for(:cupcake, @cupcake, :url => admin_cupcake_url(@cupcake), :method => :put) -- 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 -~----------~----~----~----~------~----~------~--~---
Daniel Waite wrote:> Daniel Waite wrote: >> Gerjan Stokkink wrote: >>>> >>>> form_for(:cupcake, @cupcake, admin_cupcake_url, :method => :put)Wow, I want to stab myself. Simple, simple mistakes: form_for(:cupcake, @cupcake, :url => admin_cupcake_path(@cupcake), :html => { :method => :put }) I swear I''m not new to this -- I just get excited and rush through things. -- 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 -~----------~----~----~----~------~----~------~--~---
Gerjan Stokkink wrote:> Daniel Waite wrote: >> >> Nay. Although, true, in my example I didn''t pass @cupcake to the _url >> method, I have indeed tried it, and the result is the same as if I did >> not pass it. >> >> form_for(:cupcake, @cupcake, admin_cupcake_url(@cupcake), :method => >> :put) > > Hmm, try this: > > form_for(:cupcake, @cupcake, :url => admin_cupcake_url(@cupcake), > :method => :put)LOL. I was moments too late. Thanks again Gerjan! You rock. :) -- 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 -~----------~----~----~----~------~----~------~--~---