GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
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?
Seems bad. It is true that scoped is deprecated...
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.
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.
Not without calling it.
I think we have to add a version check.
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.
@tovodeverett I'm not keen on changing it to use current_scope directly.
Three cheers for @haines! Thanks a lot for fixing this!
@nmk no problem! Thanks for reporting :)