On Thu, Dec 20, 2012 at 6:58 PM, Jim Ruther Nill <jvn...@gmail.com> wrote:

>
>
>
> On Thu, Dec 20, 2012 at 6:47 PM, Binny Zupnick <li...@ruby-forum.com>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]
>

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


>
>
>>
>> Attachments:
>> http://www.ruby-forum.com/attachment/7986/code.txt
>>
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
> --
> -------------------------------------------------------------
> visit my blog at http://jimlabs.heroku.com
>



-- 
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to