I am trying to add a custom restful action. I have try the following
tutorial but stil get an error and not sure why
http://guides.rubyonrails.org/routing.html,
http://railscasts.com/episodes/35-custom-rest-actions
Here what i am trying to do in my model customer
i have def the following
def friend
@customer = Customer.find(params[:id])
end
Here my route
resources :customers do
collection do
get 'friend'
end
end
Here the link i try so far
http://localhost:3000/customers/friend
http://localhost:3000/customers/1/friend
I also try member but same error occurs. There error is follow
ActiveRecord::RecordNotFound in CustomersController#friend
Couldn't find Customer without an ID
Thanks in advance
--
Posted via http://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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.