Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please, restore should_have_default_scope in rails-3.1 branch #35

Open
maksar opened this issue Nov 17, 2011 · 1 comment
Open

Please, restore should_have_default_scope in rails-3.1 branch #35

maksar opened this issue Nov 17, 2011 · 1 comment

Comments

@maksar
Copy link

maksar commented Nov 17, 2011

Following code could be used to ensure, that default scope works as expected:

EmailLetter.scoped.to_sql.should == EmailLetter.unscoped.where(:sent => false, :error => false).to_sql

Usage would be:

it { should have_default_scope.where(:sent => false, :error => false) }

I'll provide pull request if needed.

@hosh
Copy link
Contributor

hosh commented Nov 17, 2011

If you can make it work and pass the specs I'll gladly accept a pull request. I cut them out somewhere in alpha1 or alpha2 because of the way the arel matching works did not work with default_scopes. The .to_sql conversion doesn't always work everywhere either, at least in the 3.0 series.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants