What is the difference between “rake db:seed” and rake db:fixtures:load”

rake db:seed loads the data from db/seeds.rb into the database. This is generally used for development and production databases. It’s permanent data that you use to start an empty application. More information here. rake db:fixtures:load loads the test fixtures into the test database. This is temporary data used solely by the tests. You can think … Read more

Generate model in Rails using user_id:integer vs user:references

Both will generate the same columns when you run the migration. In rails console, you can see that this is the case: The second command adds a belongs_to :user relationship in your Micropost model whereas the first does not. When this relationship is specified, ActiveRecord will assume that the foreign key is kept in the user_id column and it … Read more