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

Deprecate Class handler in PredicateBuilder #17916

Merged
merged 1 commit into from
Dec 4, 2014

Conversation

mrgilman
Copy link

@mrgilman mrgilman commented Dec 4, 2014

Users should pass strings to queries instead of classes

@rafaelfranca
Copy link
Member

Could you add a CHANGELOG entry?

@mrgilman
Copy link
Author

mrgilman commented Dec 4, 2014

Sure thing.

Users should pass strings to queries instead of classes
@mrgilman mrgilman force-pushed the deprecate-class-handler branch from 0c1e0dd to c0609dd Compare December 4, 2014 20:06
@mrgilman
Copy link
Author

mrgilman commented Dec 4, 2014

Added a CHANGELOG entry.

sgrif added a commit that referenced this pull request Dec 4, 2014
Deprecate `Class` handler in `PredicateBuilder`
@sgrif sgrif merged commit 6c9ed6d into rails:master Dec 4, 2014
@joergschray
Copy link
Contributor

Passing a class for the type column of a polymorphic relationship or an STI table makes perfect sense to me. Of course you can work around it by defining a visitor in Arel, but that's not readily accessible for most users. So I think the use case in the test should be fixed, but not the concept as such.

@sgrif
Copy link
Contributor

sgrif commented Dec 8, 2014

Why is passing Foo so much better than calling "Foo"? You can also call .name on the class if you need to take one as an argument. It simply adds cruft to our code for a type that has no semantics on its own.

@joergschray
Copy link
Contributor

For a namespaced class Foo is not equivalent to "Foo". Yes I can also call .name - but why is passing a symbol or an ActiveRecord instance allowed - I could also call .to_s or .id on it. What is the criteria to approve of one and disapprove of the other?

@rafaelfranca
Copy link
Member

What is the criteria to approve of one and disapprove of the other?

I'd say usage. Symbol and Active Record instance are more used.

pikender pushed a commit to vinsol-spree-contrib/spree_marketing that referenced this pull request Feb 3, 2017
Fixed Deprecation Warning :: Passing a class as a value in an Active Record query is deprecated and will be removed. Pass a string instead.
Refer rails/rails#17916
Used Rspec stub_const to silence CONSTANT redefinition warnings
Pending: Failing Specs for acts_as_multilist concern
TRACE_START
Spree::Marketing::List::MostZoneWiseOrders behaves like acts_as_multilist .generator if list doesn't exists should change result by 1
      Failure/Error: it { expect { list_type.send :generator }.to change { list_type.all.count }.by 1 }
        expected result to have changed by 1, but was changed by 0
      Shared Example Group: "acts_as_multilist" called from ./spec/models/spree/marketing/list/most_zone_wise_orders_list_spec.rb:12
      # ./spec/shared/acts_as_multilist.rb:59:in `block (4 levels) in <top (required)>'
TRACE_END
alexdunae added a commit to culturecode/crier that referenced this pull request Apr 11, 2021
alexdunae added a commit to culturecode/crier that referenced this pull request May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants