After a number of hours reading stackoverflow and watching railscasts, I've decided to post. The question is very similar if not identical to many other questions here but I'm just not getting it. This is my first has_many_through association.
class User < ActiveRecord::Base
...
has_many :affiliations
has_many :sublocations, through: :affiliations
...
end
class Sublocation < ActiveRecord::Base
...
has_many :affiliations
has_many :users, through: :affiliations
...
end
class Affiliations < ActiveRecord::Base
...
belongs_to :user
belongs_to :sublocation
...
end
The affiliations table has the usual user_id and sublocation_id columns. It also has boolean column named 'default'. In my 'new/edit user' form(s), I'm needing to select one or more sublocations via checkboxes and also include a way to mark a sublocation as 'default'.
Again, I've read example after example but something just isn't 'clicking' in my brain. I'm not necessarily looking for an exact solution but a nudge in the right direction.
Many thanks, CRS