Flowdock
method

cast

Importance_0
Ruby on Rails latest stable (v6.1.7.7) - 0 notes - Class: Numeric
cast(value) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activemodel/lib/active_model/type/helpers/numeric.rb, line 11
        def cast(value)
          # Checks whether the value is numeric. Spaceship operator
          # will return nil if value is not numeric.
          value = if value <=> 0
            value
          else
            case value
            when true then 1
            when false then 0
            else value.presence
            end
          end

          super(value)
        end
Register or log in to add new notes.