John Bachir
John Bachir

Reputation: 22751

How can I use the rails console in a non-rails project?

My project is not a web server. I'm using ActiveRecord and ActiveSupport. I'd like to also have the rails console. How can I do this without generating an entire rails app (and/or, what's the most minimal way to do this?)

Upvotes: 3

Views: 1402

Answers (1)

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230531

Of course, there's no such thing as "rails console in a non-rails app".

What rails console essentially is, however, is just an IRB session with your app classes loaded. So you can do the same by running

irb -rapp.rb

where app.rb is your "environment" file which loads most/all of the classes. You know, the one with all the require lines.

Upvotes: 15

Related Questions