initially populate data in rails if database is empty from application -
i have created database migration, , migrated data both on development , production servers. populate database application, if empty , avoid rake db:seed , other similar methods. know done through rake db:seed, since application deployed not pollute deploy.rb capistrano, or manually on both development , production.
is there hook on database open or initialization of active record can like
if !pages.first pages.populate end
i aware of recommended methods populate database, still prefer app.
thanks
as eluded to, not best idea in world, maybe try using on of these approaches:
- an initializer called each time rails environment loaded.
- something in
config.after_initialize
block. see http://guides.rubyonrails.org/configuring.html
Comments
Post a Comment