On 14 June 2011 15:46, Sta Canovist <stacanov...@gmail.com> wrote:
>
>
> 2011/6/14 Walter Davis <wa...@wdstudio.com>
>>
>> This looks like the path you want to post your form results to, but if
>> this is a POST, you should be hitting :action => 'update' rather than
>> 'edit'.
>>
>> To load the form that you will fill with new data for your update, you
>> would have a matching route that used GET, and hit :action => 'edit'.
>>
>> If you don't want to use REST conventions (GET to load the edit, form POST
>> to accept the update) then you need to get out of that end of the pool and
>> use older-style non-RESTful routes, which you can spot by their dangling
>> ids:
>>
>> /admin/accounts/2/portals/edit/4
>>
>> Have a look at the very bottom of your routes file for comments about
>> configuring those, I'm not sure what the syntax would be in Rails 3, haven't
>> done those since Rails 2.
>>
>> Walter
>
> Well, I dont care very much how. The thing is that create and edit will be
> called from another application through curl. So I will never need to go to
> the presentation page for edit and create. It is just enough that there will
> be route for when the form is posted.
>
> As I said, it works for create. But not for edit. I wonder why it works for
> create but not edit.

As Walter said it is because you should be using update not edit.  In
normal use with a browser new is used to get a form to fill in then
create is used to create the record, edit is used to get the form for
editing a record then update is used to do the update.  So the form
should be posted to update not edit and that is what the standard
routes are set up for.

>
> So you say the only solution is to add a custom route? Do you mean that kind
> of routes like:

No, just use the standard *update* route

Colin

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to