A
A
Alexander Isaev2016-03-26 02:45:07
Ruby on Rails
Alexander Isaev, 2016-03-26 02:45:07

How to edit a service without going to another page?

Hello everyone) I want to edit services without going to another page. I use the "best_in_place" gem. There is a user's personal page user/:id and in the same page the user can add services to his page, they are displayed there. In general, I do this:
1)<% @user.services.order("created_at desc").each do |service| %>
<%= best_in_place service, :content, :path => user_path %>
<% end %> Undefined
method `service_path' error appears
I hope you can help me.))
Thank you)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Beloshitsky, 2016-03-26
@mbeloshitsky

The absence of the service_path method indicates that your service controller is not declared as a resource in the routes . Add to routes.rb
If for some reason this is not possible, then add the method service_pathmanually to app/helpers/services_helper.rb. The method must take 1 parameter - the id of your service and return the url to this service.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question