Re: using params in a comparison

Dave Lynam
Wed, 28 May 2008 02:04:33 -0000

exactly what i was looking for.  thanks.

On May 27, 6:56 pm, Alex Wayne
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:
> Dave Lynam wrote:
> > Other is a column in the database.  So photo.other is the value in
> > this column and I only want to display the photos where the
> > params[:id] matches this photo.other value.
>
> > On May 27, 6:29 pm, "Ryan Bigg (Radar)"
<radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
>   123 == "123" #=> false
>
> The params hash contains strings.  A database column stored as an
> integer, will return an integer.  And an integer will not equate to a
> string.
>
>   photo.other == params[:id].to_i
>
> or
>
>   photo.other.to_s == params[:id]
> --
> Posted viahttp://www.ruby-forum.com/.