My app has a model called User
(it includes the email adress, username..)
I want to create a model Message
it should have two fields sender
and recipient
. Both are references to the User
model. I tried this:
rails generate model Message sender:references recipient:references
Rails generated this:
class Message < ActiveRecord::Base
belongs_to :sender
belongs_to :recipient
end
But I don't want two different models. Both fields should reference to User
. I'm running Ruby 2.0.0 and Rails 4.0.2. Any help is highly appreciated. Please ask me if you need more information about my problem.