Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/jsonapi/active_relation_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def find_related_polymorphic_fragments(source_rids, relationship, options, conne
end
end

relation_position = relation_positions[row[2].downcase.pluralize]
relation_position = relation_positions[row[2].underscore.pluralize]
model_fields = relation_position[:model_fields]
cache_field = relation_position[:cache_field]
cache_offset = relation_position[:cache_offset]
Expand Down
4 changes: 2 additions & 2 deletions lib/jsonapi/basic_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ def _polymorphic_name
if !_polymorphic
''
else
@_polymorphic_name ||= _model_name.to_s.downcase
@_polymorphic_name ||= _model_name.to_s.underscore
end
end

Expand Down Expand Up @@ -927,7 +927,7 @@ def _polymorphic_types
next unless Module === klass
if klass < ActiveRecord::Base
klass.reflect_on_all_associations(:has_many).select{|r| r.options[:as] }.each do |reflection|
(hash[reflection.options[:as]] ||= []) << klass.name.downcase
(hash[reflection.options[:as]] ||= []) << klass.name.underscore
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/jsonapi/relationship.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def self.polymorphic_types(name)
next unless Module === klass
if ActiveRecord::Base > klass
klass.reflect_on_all_associations(:has_many).select{|r| r.options[:as] }.each do |reflection|
(hash[reflection.options[:as]] ||= []) << klass.name.downcase
(hash[reflection.options[:as]] ||= []) << klass.name.underscore
end
end
end
Expand Down