activeresource icon indicating copy to clipboard operation
activeresource copied to clipboard

Adding type casting based on schema definition

Open SergeyBurtsev opened this issue 2 years ago • 0 comments

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

SergeyBurtsev avatar Jun 18 '22 10:06 SergeyBurtsev