scheidm / quest-till-done

3 stars 0 forks source link

Migrate validations to model level #204

Closed scheidm closed 9 years ago

scheidm commented 9 years ago

I just realized that my fixes to active-quest needs to be moved to the model level. we should be checking before save that the user has an active quest, to automatically ensure that we maintain data integrity. The same should be true of other related model changes, which need to be identified before we close this.

scheidm commented 9 years ago

so I generated a quest model function update_cleanup that takes a user and resets their active quest if the closed quest was their active quest. ATM I'm calling it manually in update on the campaign controller. we could do this automatically with an after_update hook, but unless we change our schema we'd have to do an extra query for every update to catch it.

scheidm commented 9 years ago

Finished my pass of controllers, Only the groups_controller needs further cleanup, which I'll leave for tomorrow.