test for last row in object

8 views
Skip to first unread message

fugee ohu

unread,
May 5, 2017, 6:14:50 PM5/5/17
to Ruby on Rails: Talk
Seems my code is wrong here on the first line, anyone can help

unless p==@posts.last
    somevariable << ", "
end


Colin Law

unread,
May 6, 2017, 3:18:15 AM5/6/17
to Ruby on Rails: Talk
On 5 May 2017 at 23:14, fugee ohu <fuge...@gmail.com> wrote:
> Seems my code is wrong here on the first line, anyone can help
>
> unless p==@posts.last

Are you expecting that to check all the attributes of p and
@posts.last and see if they are the same?

> somevariable << ", "
> end
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/a1f37edc-12dd-4f56-9bb5-f39ba57dc56d%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages