I am using Ruby on Rails 3.2.2 and I would like to know if the following is a \"proper\"/\"correct\"/\"sure\" way to override a setter method for a my class attribute.
I have found that (at least for ActiveRecord relationship collections) the following pattern works:
has_many :specialties def specialty_ids=(values) super values.uniq.first(3) end
(This grabs the first 3 non-duplicate entries in the array passed.)