activeresource
activeresource copied to clipboard
Adding type casting based on schema definition
I'm learning to use Github's pull requests, so I could contribute to my favourite gems. Please do not judge harshly if I'm doing something wrong - it is not because of ignorance, but inexperience.
This pull request adds naive but workable solution for casting types base on schema definition.
For example:
Person.schema = { age: :integer, married: :boolean }
person = Person.new(age: "43.2", married: "1")
assert_equal 43, person.age
assert_equal true, person.married