lundi 11 mai 2015

undefined method `refreshProfile_affinity_path' for #

I'm getting the error in the title. I am not sure how exactly to write the routes, controller, and index.

I am trying to create a 'Refresh' button in an index.haml.erb view shown below:

...
<td><%= link_to 'Refresh', refreshProfile_affinity_path(a), method: :put %></td>
...

It is using this route in routes.rb:

  resources :affinities
  put 'affinities/refreshProfile/:id' => 'affinities#refreshProfile'

It is trying to access the following method in the affinities_controller.erb:

...
def refreshProfile
    @affinity = Affinity.find(params[:id])
    new_profile_affinity = User.find(@affinity.user_A_id).profile_affinity_with(User.find(@affinity.user_B_id))

    if @affinity.update_attributes(:integer, new_profile_affinity)
        redirect_to @affinity
    end
end
...

Aucun commentaire:

Enregistrer un commentaire