Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7898419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:25:41+00:00 2026-06-03T08:25:41+00:00

In order to debug a factory I’ve inserted rescue binding.pry at the end of

  • 0

In order to debug a factory I’ve inserted rescue binding.pry at the end of a problematic line:

after_create do |my_object, proxy|
  my_object.foreign_key_id = proxy.generated_attribute rescue binding.pry

Unfortunately, inside the resulting FactoryGirl::Declaration::Implicit context I can’t seem to access the context like I would in “normal” code (NameError: undefined local variable or method `proxy' for #<FactoryGirl::Declaration::Implicit:0x0...>). How do I inspect and manipulate my_object and proxy within the Pry session?

The code is called as part of the background of a Cucumber feature:

Given the following my_objects exist:
| property |
| value    |

factory_girl_rails and factory_girl/step_definitions.rb are required by the support script.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:25:42+00:00Added an answer on June 3, 2026 at 8:25 am

    In order to allow attribute names to define attributes without having a block argument, factory_girl evaluates the definition block using instance_eval and undefines most private methods on Object, including binding. That means that when you call binding.pry above, you’re not calling pry on the binding for that block; instead, you’re defining a new attribute with a name of “binding” and invoking pry on the created attribute definition.

    You can get around this by using Kernel.binding.pry instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In order to debug I would like to dump certain variables on to my
In order to develop and debug mobile and tablet applications, I'd like to be
In order to debug strange behavior in a Swing-application I'd like to replace the
In order to debug failing requests I would like to print all information coming
In order to debug an issue with our usage of Hibernate, I would like
In order to debug sbcl internals, I tried tracing sbcl internal packages. For example
I am having problems in order to debug an app using ruby-debug with RadRails.
I need to use Visual Studio in order to debug an F# application. What
I'm working on some Azure web apps, and in order to debug I'm running
In order to debug an asp.net web app I have to have IE Script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.