v0.8.0
- Property values from a payload are now stored as a
Hash
in the model instance to support multiple access methods. - Added an inflector so properties which don't use
snake_case
likefirstName
can now be accessed through thefirst_name
method. - Added a way to register irregular snake-cases with the inflector, for example:
reynard.snake_cases({ '1st-class' => 'first_class' })
. This particular example allows the1st-class
property on a model to be accessed through thefirst_class
method. See the README for more examples and details.
Upgrade notes
It's possible that Reynard now throws a NoMethodError
where it previously returned nil
, this may be caused by the fact that the payload is missing an optional value. You can either use try(:method_name)
in Ruby on Rails, check if the attribute is accessible with respond_to?(:method_name)
or use the []
accessor ["method_name"]
, note that you probably have to use a string in the last example.