app/models/marty/base_rule.rb in marty-1.2.8 vs app/models/marty/base_rule.rb in marty-1.2.9
- old
+ new
@@ -15,11 +15,11 @@
types += [:int, :integer] if Integer(v) rescue nil
types << :float if Float(v) rescue nil
types << :date if Date.parse(v) rescue nil
types << :datetime if DateTime.parse(v) rescue nil
types << :range if chkrange(v) rescue nil
- types << :boolean if [true, false].include?(v)
+ types << :boolean if [true, false, 'True', 'False'].include?(v)
types
end
def check(name, h)
multi, type, enum, values, req = h.values_at(:multi, :type, :enum, :values,
:required)
@@ -70,11 +70,11 @@
self.results ||= {}
end
before_create do
self.class.guard_info.each do |k,v|
- next if v[:default].blank? || self.simple_guards.include?(k)
+ next if !v.include?(:default) || self.simple_guards.include?(k)
self.simple_guards[k] = v[:default]
end
end
def self.get_subq(field, subfield, multi, type, vraw)
@@ -106,10 +106,10 @@
end.join(" OR ")
isn = "simple_guards->'#{use_k}' IS NULL OR"
q = q.where("(#{isn} #{filts})")
end
- # print q.to_sql
+ #print q.to_sql
q.order(:name)
end
end