Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

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

#5489

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.
activerecord-2.3.8/lib/active_record/observer.rb:183: Set.new([self.class.observed_class].compact.flatten)

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.

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

State: stale
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Stuart Zilm
    Stuart Zilm
    • 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.

    August 30th, 2010 @ 04:17 PM

  2. rails
    rails
    • 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.

    February 21st, 2011 @ 12:00 AM

  3. rails
    rails
    • State changed from open to stale

    February 21st, 2011 @ 12:00 AM