diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-02-28 19:42:02 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-02-28 19:42:02 +0900 |
commit | a3b16b955f053663feed41d938ba0d42363b2097 (patch) | |
tree | f2f71f8c4d326c4f09903c1063f177b468402d2a /activesupport/lib/active_support/inflector | |
parent | d50380f4e3f9e8d9398c8fdcbe5f52f784d14f5f (diff) | |
download | rails-a3b16b955f053663feed41d938ba0d42363b2097.tar.gz rails-a3b16b955f053663feed41d938ba0d42363b2097.tar.bz2 rails-a3b16b955f053663feed41d938ba0d42363b2097.zip |
`valid_type?` should accept only supported types
`valid_type?` is used in schema dumper to determine if a type is
supported. So if `valid_type?(:foobar)` is true, it means that schema
dumper is allowed to create `t.foobar`. But it doesn't work. I think
that `valid_type?` should accept only supported types.
https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/schema_dumper.rb#L135-L142
```ruby
columns.each do |column|
raise StandardError, "Unknown type '#{column.sql_type}' for column '#{column.name}'" unless @connection.valid_type?(column.type)
next if column.name == pk
type, colspec = @connection.column_spec(column)
tbl.print " t.#{type} #{column.name.inspect}"
tbl.print ", #{format_colspec(colspec)}" if colspec.present?
tbl.puts
end
```
Diffstat (limited to 'activesupport/lib/active_support/inflector')
0 files changed, 0 insertions, 0 deletions