Fix rational to decimal on type_cast_from_user

We ran into a problem with Rationals and the `Decimal#cast_value` method. 
For a `Rational` type, use a precision or fallback to default `BigDecimal.new(value, 0)`

@Overbryd and @marianovalles
This should be `value.to_d(precision)`, I wonder if we can change this to an arity check of `to_d`, rather than an `is_a?` check. e.g.

```ruby
unless value.respond_to?(:to_d)
  value = value.to_s
end

if value.method(:to_d).arity != 0
  value.to_d(precision)
else
  value.to_d
end
```