I have this in the controller:
@artists = Artist.where("artist LIKE ?", "%#{params[:term]}%").limit(500).paginate(params[:page])
And I get can't dup NilClass .
Now params [: term] and params [: page] are two different variables, so why should the error appear? If I remove the second params variable, the error will disappear.
It will still appear, even if I do the following:
page = params[:page]
Then below:
paginate(page)
I would like to understand why this is happening and how to fix it, how to use 2 variables from params () on the same line without this error.
Edit
I found that integer substitution for params [: page] leads to a slightly different error: can't dup FixNum , so maybe the problem is not with the parameters, but with something else. However, I do not know how to solve this.
source share