Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wrong number of arguments (1 for 0) when trying to destroy instance

I keep getting an error: wrong number of arguments (1 for 0)

def destroy
    @event = Event.find(params(:id))
    @event.destroy
    flash[:success] = "Event destroyed."
    redirect_to events_path
end

i'm trying to destroy an @event and it doesn't work because @event = Event.find(params(:id)) has the wrong number of parameters. what am i doing wrong?

like image 271
Matthew Berman Avatar asked Jun 06 '11 02:06

Matthew Berman


1 Answers

It should be params[:id] instead of params(:id).

like image 139
Mischa Avatar answered Oct 24 '22 05:10

Mischa