Skip to content

Changes to has_many in 1.5.0

Anthony Persaud edited this page Sep 28, 2016 · 1 revision

Changes to has_many in 1.5.0 and later

Before Parse-Stack 1.5.0, all has_many relationships that weren't explicit on association implementation type were set to :array. This default has now been change to be more inline with other database systems as well as be more closely related to ActiveRecord-like functionality. The new default is :query.

If you used to implement has_many relationships in Parse with an local array, your code might have looked like the example below. The example states that the local class Artist has a column of Array type that contains a set of Parse pointers of Song type.

# pre 1.5.0
class Artist
   # assumed `through: :array` implementation
   has_many :songs 
end

class Song
end

Upgrading to 1.5.0 and later

To change your code, just add the through: :array option to the has_many method. The code would change to:

   # 1.5.0 and later
class Artist
   has_many :songs, through: :array
end

class Song
end