I have a Product model, and I want to be able to define a single Product as a “featured” product. How would I go about setting this up? I have a boolean column, “featured”, but I haven’t a clue how to ensure that only one of them is true at any time.
Share
The piece you are probably missing is ActiveRecord::Base#update_all. I would probably hook into before_save, and do something like this