You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.<<
The clue is often in the error message, it is worth reading it
carefully.
It is saying that you have something << where the something is nil.
You have not told us which line it is failing on, but presumably it is
either @selected_ratings or @movies. What are they set to before the
lines you have shown us?
Maybe i should explained a bit more about the problem. So the thing is
that that i have a movie table in the database with properties such as
titile, rating etc. Now i have a check box of ratings like
[‘G’,‘PG’,‘R’]. When a user selects one or more of these check boxes
then i have those in my params[ratings]. For example if he chooses ‘R’
and ‘G’ then my params[rating] would be [‘G’, ‘R’]. Now, what i want to
do is to have only those movies which have the following ratings in my @movies and for that i am trying to use
Since you have not quoted the previous reply we do not know whether
this is in reply to Jordan’s suggestion. If it is in reply to his
suggestion then you should quote it and make clear why it does not
work.
Colin
My previous reply was not in reply to Jordans suggestions it was
description of my original problem which i later realized requires
description. Since i cannot edit my original question any more so had to
do it in middle of the thread
Since you have not quoted the previous reply we do not know whether
this is in reply to Jordan’s suggestion. If it is in reply to his
suggestion then you should quote it and make clear why it does not
work.
Colin
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.