我正在使用Mongoid在表上执行批量插入,其中batch是一个哈希数组:批量插入是否可以在Mongodb中进行验证?
@state = State.new
@state.collection.insert batch
我是否通过这种方式绕过Activerecord?当我尝试验证记录时没有任何反应。
validates_format_of :population, :with => /\d+/
我也在尝试执行回调来格式化数据。
before_validation :generate_population
没有任何反应。
有没有一种解决方法可以批量插入进行验证工作? – 2011-03-27 15:50:45
上面添加了注释 – 2011-03-27 16:09:17