I have 3 models
class User < ...
belongs_to :language
has_many :posts
end
class Post < ...
belongs_to :user
belongs_to :language
end
class Language < ...
has_many :users
has_many :posts
end
Im going to be creating lots of posts via users and at the same time I have to also specify the language the post was written in, which is always the language associatd with the user i.e.
@user.posts.create(:text => "blah", :language_id => @user.language_id)
That's fine but the way I set the language doesn't sit well with me. The language will always be that of the users so is there a 'best-practice' way of doing this?
I know a little about callbacks and association extensions but not sure of any pitfalls.