Skip to content

Mixing reload! into Rails binding.pry sessions #99

@jm3

Description

@jm3

Hi, just opened pry/pry#1743. I know now that recent Rails versions only mix in reload! and friends to the top-level REPL context, as opposed to mixing them into Object, which means they won't be available inside a binding.pry session in the context of a specific class.

@rf- said:

You might be able to make it work by running extend Rails::ConsoleMethods after starting the session (possibly after running require "rails/console/app" and require "rails/console/helpers"). If that doesn't help then feel free to open an issue on pry-rails and we could discuss ways of making this easier.

Running that in my Rails binding.pry session did indeed work. Now I'd like to avoid typing it every time I run pry. To that end, I tried pasting it into my ~/.irbrc file, and into a ~/.pryrc file, but it didn't seem to work.

Any tips for making pry run this automatically for future Rails sessions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions