Invalid mix of scope block and deprecated finder options on ActiveRecord association


While upgrading from rails 3.2.22.5 to rails 4.2.6

has_many :subitems, through: :child_associations, source: :child, source_type: 'ContentItem', conditions: 'content_items.deleted  1', order: 'content_associations.position ASC'
  1. Replaced conditions with proc
has_many :subitems, ->{where('content_items.deleted  1')}, through: :child_associations, source: :child, source_type: 'ContentItem',  order: 'content_associations.position ASC'

2. Place order in proc

has_many :subitems, ->{where('content_items.deleted  1').order('content_associations.position ASC') }, through: :child_associations, source: :child, source_type: 'ContentItem'
Advertisements

I am Senior Software Engineer. I love reading, writing, sharing,developing, hiking, movies, trips, mountains, brooks, hills etc.

Posted in Uncategorized, upgrade from rails 3 to 4

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

StackOverFlow
Categories
Archives
%d bloggers like this: