Skip to content

Commit

Permalink
Use the klass that is instantiated associations when building a resou…
Browse files Browse the repository at this point in the history
…rce from xml
  • Loading branch information
cbarton committed Jun 25, 2015
1 parent ab3fbc0 commit 54a2c37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1.5
6 changes: 3 additions & 3 deletions lib/recurly/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -404,15 +404,15 @@ def from_xml xml

if el.children.empty? && href = el.attribute('href')
resource_class = Recurly.const_get(
Helper.classify(association_class_name(el.name) ||
Helper.classify(klass.association_class_name(el.name) ||
el.attribute('type') || el.name), false
)
case el.name
when *associations_for_relation(:has_many)
when *klass.associations_for_relation(:has_many)
record[el.name] = Pager.new(
resource_class, :uri => href.value, :parent => record
)
when *(associations_for_relation(:has_one) + associations_for_relation(:belongs_to))
when *(klass.associations_for_relation(:has_one) + klass.associations_for_relation(:belongs_to))
record.links[el.name] = {
:resource_class => resource_class,
:method => :get,
Expand Down

0 comments on commit 54a2c37

Please sign in to comment.