Topic: has_many :through with attributes in join model
i have a simple has_many through association between two models
class Participation < ActiveRecord::Base belongs_to :user belongs_to :contest end
class User < ActiveRecord::Base has_many :participations has_many :contests, :through => :participations end
class Contest < ActiveRecord::Base has_many :participations has_many :users, :through => :participations end
The Join Model Participation has contest_id, user_id and an attribute called :style which is a string
I'd like to be able to set the attribute style whenever the association is automatically created using rails method below.
@contest.users << @user
but i have no clue how to set the :style attribute of participation.