-
Notifications
You must be signed in to change notification settings - Fork 44
Description
One of the predominant use cases of this SDK is IMHO writing Rails applications. Therefore it would make sense that this SDK supports Rails conventions as much as much as possible. Unfortunately it doesn't do that currently in term of keys as symbols vs strings.
The desirable version
map_attr :my_data, default_value: { items: [] }
throws an error while, as the syntax required is
map_attr :my_data, default_value: { 'items' => [] }.
Same for ERB:
<% my_data.except(:name).keys.each do |key| %>
does not work but needs to be
<% my_data.except("name").keys.each do |key| %>
This is very un-rails-y, both in models as in views, as using HashWithIndifferentAccess gives you at least both options. If you don't want to support this out of the box due to the dependency to ActiveSupport, I would at least making an option when ActiveSupport is available (or automatically use it).