Sunday, October 21, 2012

Re: [Rails] Re: Error occured while evaluating nil

On 21 October 2012 17:04, Muhammad Salman <lists@ruby-forum.com> wrote:
> Hi,

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

>
> 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
>
> @movies << Movie.where('rating = :rating', :rating => r)
>
> but it fails
> I have tried to use
>
> @movies = Movie.where('rating = :rating', :rating => r)
>
> But in this case i have movies selected with respect to one particular
> rating for example only 'R' rated movies are shown.
>
> Also i cannot do @movies = []
> because i have movies with properties such as title etc...
>
> One more thing to add, i am new to web and database related stuff :)
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate