Reputation: 7099
Im using this gem to add private messages to my application.
https://github.com/LTe/acts-as-messageable/blob/master/lib/acts-as-messageable/message.rb
I`m trying to add remove link to message.
So in my controller i have destroy action:
def destroy
@message = current_user.messages.with_id(params[:id])
if @message.destroy
flash[:notice] = "All ok"
else
flash[:error] = "Fail"
end
end
And in my view i have link: = link_to "Delete", message_path(message.id), :method => :delete
But when im trying to click link i receive: wrong number of arguments (0 for 1)
This is related with this question: Why delete method gives me wrong path? with
Upvotes: 0
Views: 309
Reputation: 96984
The problem is that you're getting all messages, so @message
is really multiple messages. You probably want to do:
@message = Message.find(params[:id])
But this may be different for the gem. The gem's documentation has a section on deleting at the bottom of the readme.
Upvotes: 1