I have a message model which belongs to a user
and a club
.
The club
model has deleted_at
and suspended_at
fields. I currently have a method that returns all the messages for a given message type e.g. messages.where(:type => 'application')
What I am looking to achieve is to adapt that method to show that message type only if deleted_at
and suspended_at
are nil
on the associated club
model.
Im not sure whether its best to adapt that method or have a default scope that doesnt return messages if the club
deleted_at
or suspended_at
are not nil
.
I am also unsure how to adapt the method or construct a scope based on the above logic. Can anyone point me in the right direction?
The app is using Rails 3.2.
Aucun commentaire:
Enregistrer un commentaire