On Thu, Sep 24, 2020 at 3:19 AM [email protected] <[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?
>
Please submit a minimal self-contained reproducible example showing the
issue.  Without that I won't be able to help.

Thanks,
Jeremy

-- 
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/CADGZSSdDZ9Q6CRtZ2MEFMe9Qbs5N9Qq81qrF-9-Dd0%3Dj3T%3Dbng%40mail.gmail.com.

Reply via email to