3

After successful rake db:migrate (which echoes tables creation statuses), I run rake db:seed.

But rake db:seed does nothing, echoes and returns nothing.

$ rake db:seed --trace
** Invoke db:seed (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke db:load_config 
** Execute db:abort_if_pending_migrations

is the most I can get.

I identified that some record validation or creation occur, but how can I display these as a result of running rake?

user1185081
  • 1,898
  • 2
  • 21
  • 46
  • 1
    You could `p`, `puts` things inside the seed file. – razvans Mar 31 '21 at 07:19
  • 1
    As mentioned by @razvans, I just use some `puts` messages in my `seeds.rb` file to provide output on progress or issues. – Jon Apr 01 '21 at 10:48
  • Thanks for the suggestion. Yes, using puts is a good practice, as well as using create! to raise validation errors instead of having a silent script... Thanks ! – user1185081 Apr 01 '21 at 20:31
  • I used to use a flag or something when typing rails db:migrate to see the actual SQL queries – Ivan Derlich Apr 02 '21 at 00:14

0 Answers0