lib/immoscout/models/concerns/propertiable.rb in immoscout-1.3.1 vs lib/immoscout/models/concerns/propertiable.rb in immoscout-1.3.2
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module Immoscout
module Models
module Concerns
module Propertiable
extend ActiveSupport::Concern
@@ -14,10 +16,11 @@
def method_missing(method_name, *arguments, &block)
if method_name =~ /build\_(\w+)/
match = Regexp.last_match(1).intern
properties = self.class.properties
coerce_klass = properties.fetch(match).fetch(:coerce, nil)
- return super if !properties.keys.include?(match) || !coerce_klass
+ return super if !properties.key?(match) || !coerce_klass
+
send("#{match}=", coerce_klass.new)
else
super
end
end