Irbrc configuration file runs on rails 3.2 + ruby 1.9
Today I checked the project using rails 4 + ruby 2,
and I found that it didn’t upload the file .irbrc(I put the file in my home directory)
When I ran into irborrails console
What is the problem?
irbrc file
require 'irb/completion'
require 'hirb' ; Hirb.enable
ARGV.concat ["--readline", "--prompt-mode", "simple"]
IRB.conf[:SAVE_HISTORY] = 10000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
ActiveRecord::Base.logger.level = 1
ActiveRecord::Base.logger = Logger.new STDOUT
ActiveRecord::Base.connection.tables
def drop_tbl (tblname)
ActiveRecord::Migration.drop_table(eval(":"+tblname))
end
def show_tbls
tbls = ActiveRecord::Base.connection.tables
tbls.each { |tbl|
puts "#{tbl} #{tbl_name(tbl)}"
}
end
def tbl_name(name)
name.singularize.humanize.split().map{|x| x.capitalize}.join()
end
def cols (tblname)
cols = eval("#{tblname}.column_names")
ap(cols)
end
Gemfile in the project
source 'https://rubygems.org'
ruby '2.0.0'
gem 'bootstrap-sass'
gem 'coffee-rails'
gem 'rails'
gem 'haml-rails'
gem 'sass-rails'
gem 'uglifier'
gem 'jquery-rails'
group :development do
gem 'sqlite3'
gem 'pry'
gem 'pry-nav'
gem 'thin'
gem "better_errors"
gem "binding_of_caller"
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
source
share