stex / setting_accessors

Global key-value-store and database-persisted attribute accessors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

_before_type_cast should return the default value if no custom value exists

stex opened this issue · comments

Currently, calling _before_type_cast on a setting_accessor will return nil if no custom value was set yet.

Instead, it should return the default value to mimic AR's behaviour.

The main reason to fix this is that Rails' text_field form helper looks for the attribute's ´value_before_type_cast` instead of just calling it - leading to an empty input field.