* Add Rails 5.2 support.
* Add rails-5-2-stable specific gemfile and adust exclusion pattern for travis
* Revert Gemfile to original state.
* Update default Gemfile to latest rails (5.2) and latest country_select (3.1.1).
* Revert rubocop in gemspec. Add Ruby 2.5.0 to the travis test set.
* Allow older versions of railties.
* bundle update. add back activemodel requirement.
* Update Rails from RC2 to stable.
* Update gemfile.lock
* remove rails upper bounds from gemspec. rely on latest versions in gemfile
This simplification should make it compatible with Rails 5's new
Attributes API without requiring a major refactor of the FormBuilder class.
The motivation for this commit originated in #1342.
@rafaelfranca mentioned that we should be using the new type_for_attribute interface
to determine the precise type of a column instead. At first I used the interface directly like
this:
def decimal_or_float?
if object.respond_to?(:type_for_attribute)
type = object.type_for_attribute(column.name.to_s).type
type == :float || :decimal
else
column.number? && column.type != :integer
end
end
I then realized that we're already asking the column object directly for the type, so
why not simple check for the two types we care about and implement the method in a much
more straightforward *and* backward-compatible way? I ended up with this:
def decimal_or_float?
column.type == :float || :decimal
end
I could be missing something obvious but this is green in my Rails 5.0.0 app. The tests mock out the now removed number? ActiveModel method
so I had to remove that:
method: 1c389f6559/test/support/models.rb (L3-L8)