Skip to content

Commit

Permalink
Merge pull request #195 from recurly/association_fix
Browse files Browse the repository at this point in the history
Use the klass that is instantiated associations when a Resource
  • Loading branch information
judith committed Jun 25, 2015
2 parents d945e21 + 362fbd4 commit cf3e5a3
Showing 1 changed file with 3 additions and 3 deletions.
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 cf3e5a3

Please sign in to comment.