I have a partial, _approve.html.erb in my views/users directory that I would like to use in my views/friendships/index.html.erb
The partial works fine within my views/users/show.html.erb with an instance variable. However it seems to break when i call it from views/friendships/index.html.erb
_approve.html.erb
<%= link_to "Approve", friend_approval_path(@user), :class => "btn primary", :remote => false %>
views/users/show.html.erb renders fine here:
<%= render 'approve' %>
views/friendships/index.html.erb throws errors here:
<%= render :partial => 'users/approve', :locals => {:user => invite} %
This is the error:
No route matches {:controller=>"friendships", :action=>"approve"}
@useris an instance variable–not a local.Either create a
@userinstance variable from your friendships controller, or pass in a localuserfrom the user controller, or put logic in your partial to choose between the two.