This project is archived and is in readonly mode.
default_scope prevents a rake db:migrate if attributes in DB don't exist
Reported by John Henderson | June 29th, 2010 @ 12:31 PM | in 3.0.2
Rails version 3 beta 4
I just discovered that if I declared the following in the User model for example:
default_scope :conditions => { :cancelled_at => nil }
and run rake db:migrate on an empty database I get:
rake aborted!
No attribute named `cancelled_at` exists for table `users`
The following code gets around the problem, but it's not pretty.
default_scope do
{ :conditions => { :cancelled_at => nil } }
end
Comments and changes to this ticket
-
Jeremy Kemper June 29th, 2010 @ 05:43 PM
- Milestone cleared.
- State changed from new to open
- Importance changed from to Low
-
Repository June 29th, 2010 @ 06:59 PM
(from [67582f08bf86ec71a27363554bc550e929a007f7]) Push a failing test for issues [#4994] and [#5003]. http://github.com/rails/rails/commit/67582f08bf86ec71a27363554bc550...
-
Repository June 29th, 2010 @ 07:16 PM
- State changed from open to resolved
(from [af6ec607fa9af96569fd2e143147f2dc0ecd583b]) No need to check if the attribute exists (this is the same behavior as in 2.3) [#4994 state:resolved] and [#5003 state:resolved] http://github.com/rails/rails/commit/af6ec607fa9af96569fd2e143147f2...
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>
People watching this ticket
Tags
Referenced by
- 4994 Rails3: observer in config/application.rb brokes rake db:migrate Notice, that the observer just trigger the model to be lo...
- 5003 default_scope prevents a rake db:migrate if attributes in DB don't exist (from [67582f08bf86ec71a27363554bc550e929a007f7]) Push a ...
- 4994 Rails3: observer in config/application.rb brokes rake db:migrate (from [67582f08bf86ec71a27363554bc550e929a007f7]) Push a ...
- 4994 Rails3: observer in config/application.rb brokes rake db:migrate (from [af6ec607fa9af96569fd2e143147f2dc0ecd583b]) No need...
- 5003 default_scope prevents a rake db:migrate if attributes in DB don't exist (from [af6ec607fa9af96569fd2e143147f2dc0ecd583b]) No need...