iljkj
iljkj

Reputation: 789

.irbrc file not loaded by rails console

Is there a way to get "rails console" to load .irbrc? Or am I supposed to use something else?

Upvotes: 11

Views: 4867

Answers (2)

migueldiab
migueldiab

Reputation: 80

rails c does not load any other .irbrc but from the current user's home (~).

See https://gist.github.com/railsbros-dirk/719848

You can tweak your rails application.rb to load the root .irbrc file if present.

Upvotes: 0

Paweł Gościcki
Paweł Gościcki

Reputation: 9634

rails console by default loads ~/.irbrc, so I don't really understand your question. It will, however, fail silently (and do not load it) if there are some errors in this file.

One example of such error is requiring gems not defined in the Gemfile (for Rails3 + Bundler) and not rescuing from LoadErrors (or expecting the require to "just work").

Upvotes: 15

Related Questions