Also, I'd like to add, that this fails as well:

 >> ChatRoom.last.chat_room_users.first.*refresh*.readable_messages
On Thursday, September 24, 2020 at 1:19:19 PM UTC+3 [email protected] 
wrote:

> I have to following block and getting some strange behavior...
>
> class ChatRoomUser
>   one_to_many :messages,
>     key: :chat_room_id,
>     primary_key: :chat_room_id,
>     class: "ChatRoomMessage",
>     graph_block: (proc do |j, s|
>       {Sequel[j][:user_id] => Sequel[s][:user_id]}
>     end) do |ds|
>    * ds.where(user_id: user_id)*
>   end
> end
>
>
> So this works:
>
> >> ChatRoomUser[*ChatRoom.last.chat_room_users.first*
> .id].readable_messages
>
> This does not:
>
> >> *ChatRoom.last.chat_room_users.first*.readable_messages
>
> NameError: undefined local variable or method `user_id' for 
> ChatRoomUser:Class
>
>
> =====
>
> I'm not really sure where to begin to look for this issue. It appears when 
> you chain the associations, it's instantiating the objects with "something 
> different" that is causing this issue.
>
> Any thoughts?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/16914dca-b15a-40d9-bfe3-16e0c9c94a8en%40googlegroups.com.

Reply via email to