Let's say I want to create a user object using REST.
My route is:
resources :users
This generates, among others:
match('/users/new', :method => :get).to(:controller =>
'users', :action => 'new').name(:register)
match('/users', :method => :post).to(:controller => 'users', :action
=> 'create').name(:register)
This makes sense in REST, however it is not ideal when the POST has a
form error.
If the same page is rendered, the error messages are displayed, etc,
but the url in the browser location bar is "/users".
"/users" is not correct and in many cases may be a URL the user is not
allowed to access with a GET request. This means if the user
bookmarks or otherwise accesses this page again through a GET
(clicking in the bar and hitting enter), they may get an error or at
least something completely different what they would expect.
Ideally I think the url would still be "/users/new". The only way to
accomplish that is to have the POST sent to that url. Redirects are
out of the question since the original form error will be lost.
Right now, I'm forced to do this:
match('/users/new', :method => :post).to(:controller =>
'users', :action => 'create')
and use action => resource(:users, :new) in the form if I want this
improved behavior.
Am I missing something?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---