Skip to content

Instantly share code, notes, and snippets.

@code-later
Created November 29, 2010 11:25
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save code-later/719848 to your computer and use it in GitHub Desktop.
Save code-later/719848 to your computer and use it in GitHub Desktop.
Load a project specific .irbrc in your Rails 3 project
# Add this method the MyApp::Application class (in config/application.rb)
def load_console(sandbox=false)
super
project_specific_irbrc = File.join(Rails.root, ".irbrc")
puts "Loading project specific .irbrc ..."
load(project_specific_irbrc) if File.exists?(project_specific_irbrc)
end
@minimul
Copy link

minimul commented Mar 31, 2015

For Rails 4

  def load_console(app = self)
      super
      project_specific_irbrc = File.join(Rails.root, ".irbrc")
      puts "Loading project specific .irbrc ..."
      load(project_specific_irbrc) if File.exists?(project_specific_irbrc)
    end

@scrooloose
Copy link

Holy shit I worship these hacks.

Trying to get my irbrc file to load inside a container without molesting the Dockerfile.... glarrrg

Thanks :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment