You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, first of all, good stuff with this gem! Very useful making global app settings dynamic, but also to quickly create a single variable to "remember" something. Props to all the contributors and maintainer!
So I might be wrong, because I just started using this gem, but it seems that the type set for a field is being cast:
# field :foo, type: :integerSetting.foo='hello'# => 0
What do you think about making it so that if the type is set and a different type is given, an error is thrown?
# field :foo, type: :integerSetting.foo='hello'# InvalidTypeError - Got type String, expected type Integer# field :bar, type :date_timeSetting.bar='2020-12-30'# InvalidTypeErrror - Got type String, expected type DateTime
Personally, I feel like this will make it more robust to use because:
Validate is only required for more complex validations.
It prevents giving a setting an incorrect value.
It makes calling a setting more reliable and you know it will return the expected type.
Like I said, I just started using the gem, so I might be overlooking something obvious.
WDYT? Could this be a feature for v3? :)
The text was updated successfully, but these errors were encountered:
Hello, first of all, good stuff with this gem! Very useful making global app settings dynamic, but also to quickly create a single variable to "remember" something. Props to all the contributors and maintainer!
So I might be wrong, because I just started using this gem, but it seems that the
type
set for afield
is being cast:What do you think about making it so that if the type is set and a different type is given, an error is thrown?
Personally, I feel like this will make it more robust to use because:
Like I said, I just started using the gem, so I might be overlooking something obvious.
WDYT? Could this be a feature for v3? :)
The text was updated successfully, but these errors were encountered: