I have a form that has many contacts. I want to be able to delete contacts without deleting them, but deleting them. I added the attribute "deleted" to the contact table.
In most cases, I need the contacts of the forms, I want only those that are not deleted:
form.contacts.find_all_by_deleted(false)
This seems messy, so I thought about named_scope or default_scope, but many people seem to say they are evil.
I also thought about just changing the attitude of the form (is it the same as the default)? This evil?):
has_many :contacts, :conditions => ["deleted = false"]
In my admin view, I need to see all the contacts. I think I can just find the find from the "Contacts" section by adding the form identifier.
It seems that this is what people will implement the party, and must have a good agreement with the best practice.
Rails 2 Rails 3. .