Wrong number of arguments (1 to 0) when trying to destroy an instance

I keep getting the error: the wrong number of arguments (1 to 0)

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

I am trying to destroy @event and it does not work because @event = Event.find (params (: id)) has the wrong number of parameters. what am I doing wrong?

+6
source share
1 answer

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

+13
source

Source: https://habr.com/ru/post/889841/


All Articles