On Apr 6, 10:01 am, phoe san <li...@ruby-forum.com> wrote:
>
> In Route ...
>
> match "/profile/:id" => "profile#index", :as => :profile
> match "/profile/:id/edit" => "profile#edit", :as => :profile_edit
> put '/profile/:id' => "profile#update"  ## method = put for update

Your update action looks a little confused - it's updating the record
4 times which seems overkill, but it looks like you're not ever
getting to the update action - if you were an exception would be
raised at the point where you do @user.save = ... (since there is no
save= method)

match (by default) accepts all http verbs, so when your put request
comes through it gets routed to profile#index. routes are considered
in the order they are defined, so although you do have a put specific
route, rails never even looks at it because it finds match '/
profile/:id' first.

You should either make the route to index action more specific (i.e.
say that it has to be a GET) or move the route to the update index
before it

Fred
> Pls give me a hand!!!!!!!
>
> --
> Posted viahttp://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@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