Reputation: 32160
I have a user model. I want to place a limitation of the rate of which the user can change his/her name.
Obivously a person doesn't change a name every day or every week.
How would be best to implement such a limit for example able to change once a month?
The only way I can think of is placing another attributes for each existing attribute so for the :name
I will created :name_last_changed_at
and each time I would test it.
Is there a more elegant/rails-way to do it?
Upvotes: 0
Views: 67
Reputation: 2830
You can relate on updated_at
column and validate it in model.
Upvotes: 1