This project is archived and is in readonly mode.

#5489 ✓stale
Stuart Zilm

ActiveRecord Observer calls method_missing with ruby 1.9.2-p0, rake db:migrate:reset fails

Reported by Stuart Zilm | August 29th, 2010 @ 09:57 PM

Using rails 2.3.8.

After upgrading from ruby 1.9.1 to ruby 1.9.2-p0, rake db:migrate began failing on an empty database.

The culprit is ruby 1.9.2-p0's Array.flatten in ActiveRecord::Observer::observed_classes.

rake db:migrate loads the environment, instantiating the observers, before migrating the database.

Under ruby 1.9.1-p378, this line and Array.flatten in general call to_ary when available on each array element, but avoid missing_method.
Under ruby 1.9.2-p0, missing_method is called on elements that don't have to_ary.

Calls to missing_method on observed classes inheriting ActiveRecord::Base generate SQL errors if the relations do not yet exist.

Comments and changes to this ticket

  • Stuart Zilm

    Stuart Zilm August 30th, 2010 @ 04:17 PM

    • Tag changed from bugs activerecord ruby-1.9.2 to rails 2.3.8, activerecord, bugs, patch, ruby1.9.2, workaround

    Added a patch for a horrible workaround. This is not the correct solution to this issue and I fear regressions as a result.

  • rails

    rails February 21st, 2011 @ 12:00 AM

    • State changed from “new” to “open”
    • Tag changed from rails 2.3.8, activerecord, bugs, patch, ruby1.9.2, workaround to rails 238, activerecord, bugs, patch, ruby192, workaround

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • rails

    rails February 21st, 2011 @ 12:00 AM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket