-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
using Rails 3.1.3 validations fail with missing methods
I had to add these 2 methods to my model in order to create records
def parents
{}
end
def name
'Record'
end
framework trace (from the controller)
mongoid (2.4.3) lib/mongoid/attributes.rb:166:in `method_missing'
activemodel (3.1.3) lib/active_model/naming.rb:79:in `model_name'
mongoid (2.4.3) lib/mongoid/validations.rb:57:in `read_attribute_for_validation'
activemodel (3.1.3) lib/active_model/validator.rb:151:in `block in validate'
activemodel (3.1.3) lib/active_model/validator.rb:150:in `each'
activemodel (3.1.3) lib/active_model/validator.rb:150:in `validate'
activesupport (3.1.3) lib/active_support/callbacks.rb:302:in `_callback_before_719'
activesupport (3.1.3) lib/active_support/callbacks.rb:395:in `_run_validate_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
mongoid (2.4.3) lib/mongoid/callbacks.rb:43:in `block in run_callbacks'
mongoid (2.4.3) lib/mongoid/callbacks.rb:68:in `call'
mongoid (2.4.3) lib/mongoid/callbacks.rb:68:in `run_cascading_callbacks'
mongoid (2.4.3) lib/mongoid/callbacks.rb:42:in `run_callbacks'
activemodel (3.1.3) lib/active_model/validations.rb:212:in `run_validations!'
activemodel (3.1.3) lib/active_model/validations/callbacks.rb:53:in `block in run_validations!'
activesupport (3.1.3) lib/active_support/callbacks.rb:390:in `_run_validation_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
mongoid (2.4.3) lib/mongoid/callbacks.rb:43:in `block in run_callbacks'
mongoid (2.4.3) lib/mongoid/callbacks.rb:68:in `call'
mongoid (2.4.3) lib/mongoid/callbacks.rb:68:in `run_cascading_callbacks'
mongoid (2.4.3) lib/mongoid/callbacks.rb:42:in `run_callbacks'
activemodel (3.1.3) lib/active_model/validations/callbacks.rb:53:in `run_validations!'
activemodel (3.1.3) lib/active_model/validations.rb:179:in `valid?'
mongoid (2.4.3) lib/mongoid/validations.rb:75:in `valid?'
activemodel (3.1.3) lib/active_model/validations.rb:187:in `invalid?'
mongoid (2.4.3) lib/mongoid/persistence/insertion.rb:23:in `block in prepare'
mongoid (2.4.3) lib/mongoid/persistence/insertion.rb:22:in `tap'
mongoid (2.4.3) lib/mongoid/persistence/insertion.rb:22:in `prepare'
mongoid (2.4.3) lib/mongoid/persistence/operations/insert.rb:26:in `persist'
mongoid (2.4.3) lib/mongoid/persistence.rb:49:in `insert'
mongoid (2.4.3) lib/mongoid/persistence.rb:154:in `upsert'
mongoid (2.4.3) lib/mongoid/persistence.rb:177:in `block (2 levels) in create'
mongoid (2.4.3) lib/mongoid/persistence.rb:177:in `tap'
mongoid (2.4.3) lib/mongoid/persistence.rb:177:in `block in create'
mongoid (2.4.3) lib/mongoid/threaded/lifecycle.rb:173:in `_creating'
mongoid (2.4.3) lib/mongoid/persistence.rb:176:in `create'
app/controllers/sync_controller.rb:21:in `sync_data'