mardi 12 juillet 2016

Issue with scope while upgrade in rails4.2.6 from 4.1.9

Issue in rail 4.2.6 during upgrade from rails4.1.9 to 4.2.6=>

I am trying to find those record from a table in which id is same as parent_id. So i have write a scope

scope :parent_record, ->{ where(parent_id: self[:id]) } 

When i am using this scope and calculating

  self.all.parent_record

it returns "# ActiveRecord::Relation []>"

While in rails 4.1.9 it returns -

ActiveRecord::Relation [#Category id: 6, name: "Business Disruption", description: "", parent_id: 6, status: "a", target_risk: nil, lock_target_risk: false].

Ruby version - ruby-2.0.0-p598 Where i am wrong ?

Aucun commentaire:

Enregistrer un commentaire