lib/golden_fleece/context/getters.rb in golden_fleece-1.0.0 vs lib/golden_fleece/context/getters.rb in golden_fleece-1.0.1
- old
+ new
@@ -5,10 +5,10 @@
# For each attribute...
attributes.each do |attribute|
# ...and each top-level schema of each attribute...
schemas[attribute.to_sym].each do |schema_name, schema|
# ...if there isn't already an instance method named after the schema...
- if !model_class.new.respond_to?(schema_name)
+ if !model_class.method_defined?(schema_name)
# ...define a getter for that schema's value!
model_class.class_eval do
define_method schema_name do
self.class.fleece_context.schemas[attribute.to_sym][schema_name].value.compute(self)
end