Does rake db:schema:dump recreate schema.rb from migrations or the database itself?

The answer is simple: from the database. By the way – when you take a look into the source code of db:* tasks you can see that migration tasks calls schema:dump after the run desc “Migrate the database (options: VERSION=x, VERBOSE=false).” task :migrate => :environment do ActiveRecord::Migration.verbose = ENV[“VERBOSE”] ? ENV[“VERBOSE”] == “true” : true … Read more

Adding a custom seed file

Start by creating a separate directory to hold your custom seeds – this example uses db/seeds. Then, create a custom task by adding a rakefile to your lib/tasks directory: # lib/tasks/custom_seed.rake namespace :db do namespace :seed do Dir[Rails.root.join(‘db’, ‘seeds’, ‘*.rb’)].each do |filename| task_name = File.basename(filename, ‘.rb’) desc “Seed ” + task_name + “, based on … Read more

What exactly is Rake?

These answers assume you know what a DSL is, or are familiar with Make or Ant. If that’s not the case, here’s a (perhaps grossly oversimplified answer): Rake is a tool you can use with Ruby projects. It allows you to use ruby code to define “tasks” that can be run in the command line. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)