1
0
Fork 0
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:
yuuji.yaginuma 2016-06-24 17:43:25 +09:00
parent 48f896cd50
commit 8f290092f0
2 changed files with 6 additions and 0 deletions

View file

@ -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

View file

@ -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