rails 4.1 validation of arbitrary fields via hstore rails 4.1 validation of arbitrary fields via hstore postgresql postgresql

rails 4.1 validation of arbitrary fields via hstore


it happens because hstore key/values are converted to strings, and when validation tries to validate attribute :en it always will be nil, so you could replace your read_attribute_for_validation method to:

def read_attribute_for_validation(attr_name)  @data[attr_name.to_s]end

note: attr_name.to_s



also you could use store_accessor like:

store_accessor :content, :envalidates :en, presence: true