2013/01/21

rails consoleでpryを使う方法

config/initializers/pry.rbに下記を記載
begin
  require 'pry'
  module Rails
    class Console
      class IRB
        def self.start
          Pry.start
        end
      end
    end
  end
rescue LoadError => e
  puts e
end

https://github.com/rweng/pry-railsを使えばいいっぽいけど


あとRails4からは下記のようにすれば使えばいいっぽい config/application.rb
# also need to add pry to Gemfile
console do
  require "pry"
  config.console = Pry
end

0 件のコメント: