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

Fix Model.scoped deprecation #17

Closed
codez opened this issue Mar 11, 2014 · 5 comments
Closed

Fix Model.scoped deprecation #17

codez opened this issue Mar 11, 2014 · 5 comments

Comments

@codez
Copy link

codez commented Mar 11, 2014

https://github.com/CanCanCommunity/cancancan/blob/master/lib/cancan/model_adapters/active_record_adapter.rb#L100 is still using #scoped. This causes a deprecation warning in Rails 4. Use #all instead if the Rails version is 4 or greater.

@lacco
Copy link

lacco commented Mar 12, 2014

As far as I see this even causes an exception in rails 4.1.0.rc1 (undefined method scoped' for #Class:0x000001083e79a8` in that exact line). Perhaps #scoped will be completely removed in rails 4.1?

@bryanrite
Copy link
Member

From what I understand, to support the functionality provided by scoped in Rails 3 and all in Rails 4, it needs to actually be replaced with where(nil).

I'll see about fixing this, I'm trying to get the testing framework for Cancancan turned around, since it was originally built with Supermodel and WithModel... both of which don't work with rails > 3.0

So I don't actually even have tests for rails 3.1, 3.2 or 4 yet.

@bryanrite
Copy link
Member

ryanb/cancan#992

@lacco
Copy link

lacco commented Mar 12, 2014

Looks good, for me https://github.com/lacco/cancancan/commit/a98612ec98f800c464110355386337b29d9c725f works. So using all or where(nil) definitely seems to be the right direction.

@bryanrite
Copy link
Member

Closing this as fixed in #21

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

3 participants