borjagvo
borjagvo

Reputation: 2091

Pry keeps breaking although I removed binding.pry

Using gem 'pry-rails'. I run bundle exec rails c production and executed gem-cd mongoid. Then opened storage_options.rb by running edit lib/mongoid/sessions/storage_options.rb. I put a breakpoint (binding.pry) in some line and close the file. I made some test and debugged ok. When I came back and got rid of the breakpoint, Pry will keep stopping at the same point although binding.pry is not there anymore (at least what I see on the console) and when I edit the file:

Before:

From: /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/ruby/2.1.0/gems/mongoid-4.0.2/lib/mongoid/sessions/storage_options.rb @ line 134 Mongoid::Sessions::StorageOptions::ClassMethods#__evaluate__:

    129:         # @return [ Symbol ] The value as a symbol.
    130:         #
    131:         # @since 3.1.0
    132:         def __evaluate__(name)
    133:           binding.pry
 => 134:           return nil unless name
    135:           name.respond_to?(:call) ? name.call.to_sym : name.to_sym
    136:         end
    137:       end
    138:     end
    139:   end
    140: end

[1] pry(User)>

After:

From: /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/ruby/2.1.0/gems/mongoid-4.0.2/lib/mongoid/sessions/storage_options.rb @ line 134 Mongoid::Sessions::StorageOptions::ClassMethods#__evaluate__:
    129:         # @return [ Symbol ] The value as a symbol.
    130:         #
    131:         # @since 3.1.0
    132:         def __evaluate__(name)
    133:           return nil unless name
 => 134:           name.respond_to?(:call) ? name.call.to_sym : name.to_sym
    135:         end
    136:       end
    137:     end
    138:   end
    139: end

[1] pry(User)>

Why does this happen? How can I "delete" the breakpoint?

Upvotes: 1

Views: 756

Answers (1)

spickermann
spickermann

Reputation: 107117

You need to restart your server, otherwise Ruby would not reload the file and would not see your changes.

Upvotes: 1

Related Questions