Home :conditions deprecation warning rails4
Reply: 0

:conditions deprecation warning rails4

user766
1#
user766 Published in July 16, 2018, 6:22 am

i am receiving deprecation warning:

DEPRECATION WARNING: The following options in your Contact.belongs_to :customer declaration are deprecated: :conditions. Please use a scope block instead. For example, the following:

has_many :spam_comments, conditions: { spam: true }, class_name: 'Comment'

should be rewritten as the following:

has_many :spam_comments, -> { where spam: true }, class_name: 'Comment'

Here is the line with :condition

belongs_to :customer, foreign_key: 'contactable_id',\
                      conditions: "contacts.contactable_type = 'Customer'"

I just try some variants, but can't fix. Maybe i am missing something

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.317597 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO