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

Difference between rake db:migrate db:reset and db:schema:load

db:migrate runs (single) migrations that have not run yet. db:create creates the database db:drop deletes the database db:schema:load creates tables and columns within the existing database following schema.rb. This will delete existing data. db:setup does db:create, db:schema:load, db:seed db:reset does db:drop, db:setup db:migrate:reset does db:drop, db:create, db:migrate Typically, you would use db:migrate after having made changes to the schema via new migration … Read more

What is the difference between Rails.cache.clear and rake tmp:cache:clear?

The rake task only clears out files that are stored on the filesystem in “#{Rails.root}/tmp/cache”. Here’s the code for that task. https://github.com/rails/rails/blob/ef5d85709d346e55827e88f53430a2cbe1e5fb9e/railties/lib/rails/tasks/tmp.rake#L25-L30 Rails.cache.clear will do different things depending on your apps setting for config.cache_store. http://guides.rubyonrails.org/caching_with_rails.html#cache-stores If you are using config.cache_store = :file_store then Rails.cache.clear will be functionally identical to rake tmp:cache:clear. However, if you’re using some other cache_store, like :memory_store or :mem_cache_store, then only Rails.cache.clear will clear your app cache. … Read more