I have the following for which allows for creating or updating a record:
<%=form_for [:project, @permission], :remote => true do |f| %>
... You can change roles in the form... (This works great for new or existing records)
<% end %>
Inside the form, I want to provide an option to delete/destroy the permission. So I added:
<%= link_to 'remove from the team', [:project, @permission], :confirm => 'Are you sure?', :method => :delete %>
But that's not working, erroring...
It renders as follows:
<a rel="nofollow" data-method="delete" data-confirm="Are you sure?" href="/projects/4/permissions/useronproject">remove from the team</a>
Error Message: NoMethodError in PermissionsController#destroy undefined method `destroy' for nil:NilClass
Also the params being passed are only: _method delete auth token....
So I'm not sure how Rails would know what to delete?
regarding the permissionsController. I do have a destory:
def destroy
@permission.destroy
respond_to do |format|
format.js
end
end
Any thoughts on this one? thanks