So yeah, Devise is to blame here (it does the loading).
Solution - define your scopes with blocks, i.e. change

class Post
  scope :active, where(:active => true)
end

to

class Post
  scope :active, proc { where(:active => true) }
end



On 3/14/2011 7:08 AM, Lawrence Wang wrote:
Another developer and I have done some more digging on this and
determined that it only happens on the one model in our app which has
scopes and is subclassing another model with STI. It does stop happening
if we remove all our observers and comment out calls to Devise in
routes.rb, but that's not really an option...

On Sun, Mar 13, 2011 at 11:03 PM, Lawrence Wang <[email protected]
<mailto:[email protected]>> wrote:

    Hi, this is actually in response to the following thread...
    
http://groups.google.com/group/rubyonrails-core/browse_thread/thread/4446f6766b2434d8
    ...but Google Groups keeps giving me an error when I try to reply
    there.

    I'm unable to run db:schema:load because it loads the Rails
    environment, the environment loads my models, and my models have
    scopes, which query the database. This is on Rails 3.0.5 and Ruby
    1.8.7 on OSX.


--
You received this message because you are subscribed to the Google
Groups "Ruby on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to