mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
return correct type from EnumType
This commit is contained in:
parent
48f896cd50
commit
8f290092f0
2 changed files with 6 additions and 0 deletions
|
@ -105,6 +105,8 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
class EnumType < Type::Value # :nodoc:
|
class EnumType < Type::Value # :nodoc:
|
||||||
|
delegate :type, to: :subtype
|
||||||
|
|
||||||
def initialize(name, mapping, subtype)
|
def initialize(name, mapping, subtype)
|
||||||
@name = name
|
@name = name
|
||||||
@mapping = mapping
|
@mapping = mapping
|
||||||
|
|
|
@ -421,4 +421,8 @@ class EnumTest < ActiveRecord::TestCase
|
||||||
book = Book.new
|
book = Book.new
|
||||||
assert book.hard?
|
assert book.hard?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "data type of Enum type" do
|
||||||
|
assert_equal :integer, Book.type_for_attribute('status').type
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue