lib/faceted/model.rb in faceted-1.0.4 vs lib/faceted/model.rb in faceted-1.0.5
- old
+ new
@@ -27,10 +27,11 @@
end
def field(name, args={})
fields << name
define_method :"#{name}" do
- instance_variable_get("@#{name}") || args[:default]
+ val = instance_variable_get("@#{name}")
+ val.nil? ? args[:default] : val
end
unless args[:read_only]
define_method :"#{name}=" do |val|
instance_variable_set("@#{name}", val)
end