Binny Zupnick
2012-Dec-20 10:47 UTC
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. 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Jim Ruther Nill
2012-Dec-20 10:58 UTC
Re: two things seem to equal, but the UNLESS statement passes anyway.
On Thu, Dec 20, 2012 at 6:47 PM, Binny Zupnick <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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]> > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- ------------------------------------------------------------- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Jim Ruther Nill
2012-Dec-20 11:01 UTC
Re: two things seem to equal, but the UNLESS statement passes anyway.
On Thu, Dec 20, 2012 at 6:58 PM, Jim Ruther Nill <jvnill-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > On Thu, Dec 20, 2012 at 6:47 PM, Binny Zupnick <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.