lib/zendesk_api/association.rb in zendesk_api-1.0.7 vs lib/zendesk_api/association.rb in zendesk_api-1.1.0

- old
+ new

@@ -30,10 +30,12 @@ end instance = args.first namespace = @options[:class].to_s.split("::") + namespace[-1] = @options[:class].resource_path + %w(ZendeskAPI Voice).each { |ns| namespace.delete(ns) } has_parent = namespace.size > 1 || (options[:with_parent] && @options.parent) if has_parent parent_class = @options.parent ? @options.parent.class : ZendeskAPI.const_get(ZendeskAPI::Helpers.modulize_string(namespace[0])) @@ -116,10 +118,10 @@ def build_parent_namespace(parent_class, instance, options, original_options) return unless association_on_parent = parent_class.associations.detect {|a| a[:class] == @options[:class] } [ extract_parent_id(parent_class, instance, options, original_options), - @options.path || association_on_parent[:name].to_s + @options.path || association_on_parent[:path] || association_on_parent[:name].to_s ] end def extract_parent_id(parent_class, instance, options, original_options) parent_id_column = "#{parent_class.singular_resource_name}_id"