I created a model called UserHasMessages based on some SO postings. I think this seems to be creating some challenges for me:
How do I reference it with has_many? Should I use has_many :user_has_messageses?
How do I do joins? I have tried User.joins(:user_has_messages) and it is sad :(
Question:
Should I somehow change the name to UserHasMessage, and if so, how?
If I keep as plural, how do I handle these cases?
You can use the same syntax you use with legacy tables:
class OtherClass < ActiveRecord::Base
has_many :user_has_messages, :class_name => 'UserHasMessages'
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With