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

Deprecation warning when running in Rails master #484

Closed
nmk opened this issue Mar 2, 2013 · 8 comments · Fixed by #486
Closed

Deprecation warning when running in Rails master #484

nmk opened this issue Mar 2, 2013 · 8 comments · Fixed by #486

Comments

@nmk
Copy link

nmk commented Mar 2, 2013

When using draper master in a Rails app running rails master, I see the following deprecation warning:

DEPRECATION WARNING: Model.scoped is deprecated. Please use Model.all instead. (called from decorate at /Users/nmk/.rvm/gems/ruby-2.0.0-p0@ausgaben/bundler/gems/draper-7d632987578c/lib/draper/decoratable.rb:56)

When I run the draper test suite with RAILS_VERSION=master I see no such warning.

This is for current master - 7d63298.

Any idea what might be the issue?

@steveklabnik
Copy link
Member

Seems bad. It is true that scoped is deprecated...

@haines
Copy link
Contributor

haines commented Mar 2, 2013

It's used here, the tests stub scoped which is why the warning does not appear.

Given that scoped is deprecated, but all will not return a query in Rails 3.x, how should we approach this? We could either add a version check (ugh) or just silence the deprecation warning.

@nmk
Copy link
Author

nmk commented Mar 2, 2013

Is there a way to check if all returns a query or an array other than relying on a version number? This would be the cleanest option if it is available.

@steveklabnik
Copy link
Member

Not without calling it.

I think we have to add a version check.

@tovodeverett
Copy link
Contributor

While we're discussing this, I've been meaning to ask about my final comment on #412 (comment) again. Note that I suspect we could avoid the version check and effectively hide the issue (except for the corner case where someone does ModelClass.decorate) by using the suggested approach. It appears that current_scope is nodoc, but is not marked private or protected.

@haines
Copy link
Contributor

haines commented Mar 3, 2013

@tovodeverett I'm not keen on changing it to use current_scope directly.

  1. Relying on undocumented ActiveRecord internals seems fragile to me
  2. Mongoid doesn't support it
  3. ActiveRecord itself almost never uses it, instead preferring all

@haines haines closed this as completed in 47ee29c Mar 3, 2013
@nmk
Copy link
Author

nmk commented Mar 3, 2013

Three cheers for @haines! Thanks a lot for fixing this!

@haines
Copy link
Contributor

haines commented Mar 3, 2013

@nmk no problem! Thanks for reporting :)

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

Successfully merging a pull request may close this issue.

4 participants