rails環境をロードする一般的な方法



#!/usr/bin/env ruby

# Set your environment here.
ENV["RAILS_ENV"] ||= "production"

require File.dirname(__FILE__) + "/../../config/environment"

puts "Rails was loaded!"


rb /lib/tasks/file.rb RAILS_ENV=development

通常runner

rails runner your_script_here.rb