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/97e07dfa-63fb-4266-8f56-5ee29feddbc8n%40googlegroups.com.

Reply via email to