Skip to content

Commit

Permalink
Treat input as :string if attached column.type is empty
Browse files Browse the repository at this point in the history
`#column_for` can return `ActiveRecord::ConnectionAdapters::NullColumn`. `column.type` will be `nil` then.
This fix makes the InputHelper#default_input_type recognize such column as string by default, just as the whole `column` would be `nil`.

Fixes the `Unable to find input class Input` error (formtastic#1183).
  • Loading branch information
jtomaszewski committed Jan 11, 2016
1 parent 88f28a0 commit 9e9fcd5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/formtastic/helpers/input_helper.rb
Expand Up @@ -261,7 +261,8 @@ def default_input_type(method, options = {}) # @private
return :file if is_file?(method, options)
end

if column = column_for(method)
column = column_for(method)
if column && column.type
# Special cases where the column type doesn't map to an input method.
case column.type
when :string
Expand Down

0 comments on commit 9e9fcd5

Please sign in to comment.