On 15 June 2011 09:30, Sta Canovist <stacanov...@gmail.com> wrote:
> 2011/6/14 Walter Davis <wa...@wdstudio.com>
>>
>> There's the nut of the problem right there. You don't ever want to POST to
>> the 'edit' route. You want to POST to the 'update' route. So if your curl
>> application is already aware of the format of the element you're updating,
>> all you need to do is POST to 'update' and everything will Just Work™. You
>> only ever hit the (GET) 'edit' route when you want to receive back a
>> populated form, ready for editing. That form is set to POST to the 'update'
>> route.
>>
>> The reason why 'create' works for you now is because when you want to
>> create a new widget in Rails, you GET the 'new' route, which returns an
>> empty form ready for completion, and that form POSTs to the 'create' route.
>>
>> Walter
>
> Ok, but if I now have the route that looks like this:
>
> namespace :admin do
>     resources :accounts do
>       resources :portals do
>         post 'create'
>         post 'update'
>         post 'show'
>       end
>     end
>   end
>
> And then in the controller I have both (to be sure, I dont know which one of
> edit and update I should define)
> I have:
>
> def update
>
>     render :text => "update"
>     return
>   end
>
> def edit
>
>     render :text => "edit"
>     return
>   end
>
>
> Then going with curl to the url
> http://localhost:3000/admin/accounts/1/portals/edit
> or even
> http://localhost:3000/admin/accounts/1/portals/update
>
> still shows the error NO ROUTE MATCHES
>

What does rake routes show?  Is the url you are using above contained there?

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