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.

default_scope prevents a rake db:migrate if attributes in DB don't exist

#5003

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

Reported by John Henderson · June 29th, 2010 @ 12:31 PM

State: resolved
Milestone: 3.0.2
Assigned to: nobody
Importance: Low