Tag Archives: through

Validate Uniqueness on Join Tables in Rails

How to validate uniqueness in a :has_many :through relationship with Ruby on Rails. You’ll need three models in this example List, Subscriber and ListSubscriber. A list has many subscribers and a subscriber has many lists. Simple enough. Running the following code would create a new record in our database table “list_subscribers”. It will also create [...]
Posted in Ruby on Rails | Also tagged , , , | 2 Comments