How can I tell what changes ‘rake db:migrate’ will apply before applying them?
Does rake db:migrate:status (rails 3+ only) fit the bill?
Does rake db:migrate:status (rails 3+ only) fit the bill?
There’s a few reasons why your migrations won’t run, but the most common is that the system is already under the impression that all the migrations you’ve defined have already run. Each migration creates an entry in the schema_migrations table with the version column corresponding to the identifier number. If you want to force a … Read more
I’m not sure why either works, but if this is Rails and those are Rails models, your tasks should depend on the environment: task :get_roles => [ :environment ] do By depending on the :environment task, it first loads Rails. Also see: What’s the ‘environment’ task in Rake?.
I think you need to have factory girl definition like that in Gemfile: gem ‘factory_girl_rails’, :require => false And then you just require it in your spec_helper.rb like that: require ‘factory_girl_rails’ This is the way I’m always using this gem. You don’t need to require it in other places than spec_helper.rb. Your current desired approach … Read more
From YARD documentation: In the Getting Started Guide with YARD section under Using YARD to Generate Documentation, check out Documenting Extra Files or Adding Meta-Data to Extra Files. It might help.
For Rails3 applications, you might want to look into making a Railtie for your gem. You can do so with: lib/your_gem/railtie.rb require ‘your_gem’ require ‘rails’ module YourGem class Railtie < Rails::Railtie rake_tasks do require ‘path/to/rake.task’ end end end lib/your_gem.rb module YourGem require “lib/your_gem/railtie” if defined?(Rails) end Though, I had my share of difficulties with requiring … Read more
I started having the same problem this evening. It seems to be related to Rack 1.3.4. I fixed it by adding this to my Gemfile: gem ‘rack’, ‘1.3.3’ Then running: bundle update rack Incidentally, I tried Bozhidar’s suggestion before this, but to no avail.
This SO Question might help you out. The suggestion there is to add require ‘rake/dsl_definition’ above require ‘rake’ in your Rakefile.
The rake db:reset task is not supported. Heroku apps do not have permission to drop and create databases. Use the heroku pg:reset command instead.
If you just need to perform a simple script like creating a file, you can simply use a Ruby script without creating a rake task. # file origin.rb target = “target.rb” content = <<-RUBY puts “I’m the target!” RUBY File.open(target, “w+”) do |f| f.write(content) end And you can execute the file with $ ruby origin.rb