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 /activerecord/lib | |
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 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index 285b0ec243..8b627a6d4d 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -158,10 +158,6 @@ module ActiveRecord true end - def valid_type?(type) # :nodoc: - true - end - # Returns 62. SQLite supports index names up to 64 # characters. The rest is used by Rails internally to perform # temporary rename operations |