@notification = Post.where(:noti_recipient => user.id, :noti_read => 
'no').order(:datetimenumber).last

This looks innocent enough, fetching the last row of a query.

But watch what happens when I try to use foreign keys in my template.

#{@notification.user_id.username}

undefined method `username' for 2:Fixnum

However #{@notification.user_id} works fine.

What is going on?

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/Ekm1H-XSu7sJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to