Fed Up
2011-Jul-10 20:36 UTC
Rails 3 routing errors - how to remove "?format=" so no more 406 Not Acceptable responses?
I haven''t been able to find an answer yet, and unfortunately I can''t find anything useful in the API docs to fix this... I scaffolded exercise_model, but I want all the URLs to be /exercise/* That means changing form_for @exercise_model into what? I already have this entry in routes: post ''create_exercise'' => ''exercise_models#create'' A. form_for @exercise_model, :url => create_exercise(@exercise_model) That fails on the submit because action="/exercise/create?format=" makes Rails respond with "Completed 406 Not Acceptable" B. form_for @exercise_model, :as => :exercise Fails to render the page because there is no class Exercise. And all 3 of these give the very same URL as #1 above: C. form_for @exercise_model, :url => create_exercise(@exercise_model), :format => :html D. form_for @exercise_model, :url => create_exercise(@exercise_model,:format) E. or in routes.rb, making it constraints :format => "html" do create_exercise => "exercise_models#create" end What''s the trick, or can''t Rails do this? -- 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.
Chirag Singhal
2011-Jul-11 06:16 UTC
Re: Rails 3 routing errors - how to remove "?format=" so no more 406 Not Acceptable responses?
Check out the routing guide here - http://guides.rubyonrails.org/routing.html Chirag http://sumeruonrails.com On Mon, Jul 11, 2011 at 2:06 AM, Fed Up <c-soc-google-tu+vUpGKE8GsTnJN9+BGXg@public.gmane.org> wrote:> I haven''t been able to find an answer yet, and unfortunately I can''t > find anything useful in the API docs to fix this... > > I scaffolded exercise_model, but I want all the URLs to be /exercise/* > That means changing > form_for @exercise_model > into what? I already have this entry in routes: > post ''create_exercise'' => ''exercise_models#create'' > > > A. form_for @exercise_model, :url => > create_exercise(@exercise_model) > > That fails on the submit because action="/exercise/create?format=" > makes Rails respond with "Completed 406 Not Acceptable" > > B. form_for @exercise_model, :as => :exercise > > Fails to render the page because there is no class Exercise. > And all 3 of these give the very same URL as #1 above: > > C. form_for @exercise_model, :url => > create_exercise(@exercise_model), :format => :html > > D. form_for @exercise_model, :url => > create_exercise(@exercise_model,:format) > > E. or in routes.rb, making it > constraints :format => "html" do > create_exercise => "exercise_models#create" > end > > What''s the trick, or can''t Rails do this? > > -- > 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.