Skip to content

Commit eabed58

Browse files
committed
Don't allow mappings to be passed to integer_type:
This was a relic of development, when we couldn't pass the mapping directly to `polymorphic:`
1 parent c61b403 commit eabed58

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lib/polymorphic_integer_type/extensions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def belongs_to(name, scope = nil, options = {})
1313
when true then PolymorphicIntegerType::Mapping[name]
1414
when nil then options[:polymorphic]
1515
else
16-
integer_type
16+
raise ArgumentError, "Unknown integer_type value: #{integer_type.inspect}"
1717
end.dup
1818

1919
foreign_type = reflections[name.to_s].foreign_type

spec/polymorphic_integer_type_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ class InlineLink < ActiveRecord::Base
154154

155155
self.table_name = "links"
156156

157-
belongs_to :source, polymorphic: true, integer_type: {10 => "Person", 11 => "InlineAnimal"}
158-
belongs_to :target, polymorphic: true, integer_type: {10 => "Food", 13 => "InlineDrink"}
157+
belongs_to :source, polymorphic: {10 => "Person", 11 => "InlineAnimal"}
158+
belongs_to :target, polymorphic: {10 => "Food", 13 => "InlineDrink"}
159159
belongs_to :normal_target, polymorphic: true
160160
end
161161

0 commit comments

Comments
 (0)