lib/ohm.rb in ohm-0.0.4 vs lib/ohm.rb in ohm-0.0.5
- old
+ new
@@ -63,12 +63,12 @@
class Model
module Validations
include Ohm::Validations
def assert_unique(attrs)
- index_key = index_key_for(attrs, read_locals(attrs))
- assert(db.scard(index_key).zero? || db.sismember(index_key, id), [attrs, :not_unique])
+ index_key = index_key_for(Array(attrs), read_locals(Array(attrs)))
+ assert(db.scard(index_key).zero? || db.sismember(index_key, id), [Array(attrs), :not_unique])
end
end
include Validations
@@ -101,10 +101,10 @@
attr_set_reader(name)
collections << name
end
def self.index(attrs)
- indices << attrs
+ indices << Array(attrs)
end
def self.attr_list_reader(name)
class_eval <<-EOS
def #{name}