I'm always making the same steps when I do:
script/console
do you know some file to edit or something similiar to avoid doing always the same, like for example loading some particular required gem (in my casi 'spawners' :))
I'm always making the same steps when I do:
script/console
do you know some file to edit or something similiar to avoid doing always the same, like for example loading some particular required gem (in my casi 'spawners' :))
With irb, ~/.irbrc serves for that purpose. Not sure whether Rails console uses it though.
Create a file called .irbrc in your home directory and any Ruby code you put in there will be executed at the beginning of your console session. There's lots of cool improvements you can make to the console experience this way, e.g. these from Dr. Nic (the end of that article also has instructions for getting .irbrc working in Windows).
The question still stands, this is not a complete solution for initializing rails console,
what if I want to do something related to active record specific like
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.clear_active_connections!
it throws back error uninitialized constant ActiveRecord
is there something that can be loaded only when the "rails console" is initialized and does not have any side effects on application code.
Thanks, Amir