Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

valid_type? should accept only supported types #28220

Merged

Commits on Feb 28, 2017

  1. 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
    ```
    kamipo committed Feb 28, 2017
    Configuration menu
    Copy the full SHA
    a3b16b9 View commit details
    Browse the repository at this point in the history