This project is archived and is in readonly mode.
nullifying doesn't work with SQLite3
Reported by Patrik Wenger | August 4th, 2009 @ 06:06 PM
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
Comments and changes to this ticket
-
CancelProfileIsBroken September 25th, 2009 @ 12:59 PM
- Tag changed from 2.3.3, dependent, destroy, nullify, sqlite3, update_all to 2.3.3, bugmash, dependent, destroy, nullify, sqlite3, update_all
-
hsume2 (Henry) September 26th, 2009 @ 08:13 AM
+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. -
Matt Jones December 1st, 2009 @ 12:58 AM
- 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.
-
Matt Jones December 1st, 2009 @ 01:02 AM
- Tag set to 2.3.3, bugmash, dependent, destroy, nullify, sqlite3, update_all
Not sure how the tags managed to fall off...
-
Rizwan Reza February 12th, 2010 @ 12:46 PM
- Tag changed from 2.3.3, bugmash, dependent, destroy, nullify, sqlite3, update_all to 2.3.3, dependent, destroy, nullify, sqlite3, update_all
-
Santiago Pastorino February 2nd, 2011 @ 04:44 PM
- 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.
-
Santiago Pastorino February 2nd, 2011 @ 04:44 PM
- 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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>