Extending the Rails console

Topics: Ruby on Rails

By extending the Rails::ConsoleMethods namespace in an initializer like config/environments/development.rb, you can add methods than you find useful when using the Rails console:

module Rails::ConsoleMethods
  def login
    Current.user = User.first
  end
end