Rails: performing rake tasks such as migrations

My development team needs to more accurately perform rake tasks. There are certain tasks that need to be run only once after changing a specific code. Without becoming too specific, it would be necessary to update some existing user records after a new business rule for new users is implemented in the code.

We like the way migrations use the db table for logging. Is there a similar tool for rake tasks? Can we hack the Rails / ActiveRecord migration system for rake tasks?

We would prefer not to mix db-related migrations with rake tasks, so any solution that explicitly stores these separate data will be great.

Thank.

+2
source share
2 answers

only need to be run once after changing a specific code

update some existing user entries

This is migration. Use migrations. If there were no additional restrictions that you did not mention, using any operations other than migration would be a hack.

+6
source

Source: https://habr.com/ru/post/1763795/


All Articles