Refactor the attribute predicate methods

For all types other than string based types, this calculation ultimately
came down to whether or not we consider the value to be "false", and if
it's blank. For string types alone, "0" should be considered present.
This also allows us to remove the `number?` predicate from the type
objects.
Yes.


On Sun, Jul 6, 2014 at 4:20 PM, Eugene Gilburg <notifications@github.com>
wrote:

> In activerecord/lib/active_record/type/numeric.rb:
>
> > @@ -19,6 +15,10 @@ def changed?(old_value, _new_value, new_value_before_type_cast) # :nodoc:
> >          super || number_to_non_number?(old_value, new_value_before_type_cast)
> >        end
> >
> > +      def value_present?(value)
> > +        super && !value.zero?
>
> Is the value passed here always guaranteed to be numeric (e.g. already
> casted)? Otherwise will get method missing.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/rails/rails/pull/16073/files#r14578044>.
>



-- 

Thanks,
Sean Griffin