Two things seem to equal, but the UNLESS statement passes anyway

when params[:which_post] happens to equal the users last message, the
UNLESS staement on line 11 passes when in fact they both equal. I’ve
done testing and I know the params work and they do in fact equal each
other, but it still passes when it shouldn’t.

On Thu, Dec 20, 2012 at 6:47 PM, Binny Z. [email protected]
wrote:

when params[:which_post] happens to equal the users last message, the
UNLESS staement on line 11 passes when in fact they both equal. I’ve
done testing and I know the params work and they do in fact equal each
other, but it still passes when it shouldn’t.

nothing that is passed as a params will be typecasted as an integer so
you
may need
to apply a .to_s to @message.id or .to_i to params[:which_post]

“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.

On Thu, Dec 20, 2012 at 6:58 PM, Jim Ruther N. [email protected]
wrote:

nothing that is passed as a params will be typecasted as an integer so you
may need
to apply a .to_s to @message.id or .to_i to params[:which_post]

just a follow up, it is better to assign the records to an instance
variable in the controller.
something like

setup which_post here

@messages = @user.messages.where(‘messages.id != ?’, which_post)

and then just use @messages on the view

visit my blog at http://jimlabs.heroku.com