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.

nullifying doesn't work with SQLite3

#2995

I have the following models:

=============== begin ================

class User < ActiveRecord::Base; has_many :migrations, :dependent => :nullify end

class Migration < ActiveRecord::Base; belongs_to :user end

=============== end ================

When I destroy a user with "@user.destroy" i get the following error:

=============== begin ================

NoMethodError in UsersController#destroy

undefined method update_all' for #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x000000037ae740>

=============== end ================

I think the object receiving the method call to update_all() is wrong.
It should be User.

Rails 2.3.3
Ruby 1.9
Passenger 2.2.4
SQLite3-Ruby 1.2.4

Reported by Patrik Wenger · August 4th, 2009 @ 06:06 PM

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

Activity

  1. CancelProfileIsBroken
    CancelProfileIsBroken
    • Tag changed from 2.3.3, dependent, destroy, nullify, sqlite3, update_all to 2.3.3, bugmash, dependent, destroy, nullify, sqlite3, update_all

    September 25th, 2009 @ 12:59 PM

  2. hsume2 (Henry)
    hsume2 (Henry)

    +1 confirmed in 2-3-stable

    I'm pretty positive it has something to do with the class being called Migration, also, it's not just dependent associations. Simply calling @user.migrations threw:

        NoMethodError: undefined method `quoted_table_name' for #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x1023aecd0>
    

    Naming the Migration class to something else but keeping the same table (via set_table_name 'migrations') worked fine (and vice versa: failed with same class name, but different table name), which leads me to believe it's not a table name problem.

    September 26th, 2009 @ 08:13 AM

  3. Matt Jones
    Matt Jones
    • Tag cleared.

    Does adding :class_name => '::Migration' to the has_many help? I'd suspect that's the issue, as the bare reference to 'Migration' (in the generated code) is going to grab ActiveRecord::Migration, not your model.

    December 1st, 2009 @ 12:58 AM

  4. Matt Jones
    Matt Jones
    • Tag set to 2.3.3, bugmash, dependent, destroy, nullify, sqlite3, update_all

    Not sure how the tags managed to fall off...

    December 1st, 2009 @ 01:02 AM

  5. Rizwan Reza
    Rizwan Reza
    • Tag changed from 2.3.3, bugmash, dependent, destroy, nullify, sqlite3, update_all to 2.3.3, dependent, destroy, nullify, sqlite3, update_all

    February 12th, 2010 @ 12:46 PM

  6. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open
    • Tag changed from 2.3.3, dependent, destroy, nullify, sqlite3, update_all to 233, dependent, destroy, nullify, sqlite3, update_all
    • Importance changed from to

    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 2nd, 2011 @ 04:44 PM

  7. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:44 PM