def self.association_prefix(options)
options = options.dup
association_prefix = ''
if belongs_to_associations
used_associations = prefix_associations(options)
association_prefix = used_associations.map do |association|
collection_name = association.associated_class.collection_name
if association.associated_class.singleton?
collection_name
else
value = options.delete("#{association.attribute}_id".intern)
"#{collection_name}/#{value}"
end
end.join('/')
association_prefix << '/' unless used_associations.empty?
end
association_prefix
end