-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
Hi Guys,
I have the following models:
class A include Mongoid::Document after_save :x belongs_to :b def x B.create a: self end end class B include Mongoid::Document has_one :a validates_presence_of :a end
Then, I create an instance of
Unable to find source-code formatter for language: a. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
.create
and I got an stack level too deep. This happen because the method
Unable to find source-code formatter for language: validates_presence_of```. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
save the new instance of
A
(autosave is enabled by default: https://github.com/mongoid/mongoid/issues/1675). But the callback is invoked after the object was created. If I set
autosave: false
the method
validates_presence_of
does not save
A
instance. This is a bug? Or I should set
autosave: false{{`}}?