मैं mongoid rails3mongid एम्बेडेड दस्तावेज़ कॉलबैक
class Address
include Mongoid::Document
embedded_in :person, :inverse_of => :address
after_validation :call_after_validation
before_validation :call_before_validation
before_update :call_before_update
after_update :call_after_update
after_create :call_after_create
before_create :call_before_create
field :address1
field :address2
private
def call_after_validation
puts "After validation callback fired."
end
def call_before_validation
puts "Before validation callback fired."
end
def call_before_update
puts "Before update callback fired."
end
def call_after_update
puts "After update callback fired."
end
def call_after_create
puts "After create callback fired."
end
def call_before_create
puts "Before create callback fired."
end
end
class Person
include Mongoid::Document
embeds_one :address
field :name
end
के साथ एक निम्नलिखित मॉडल अब मैं एक ही बार में व्यक्ति और पता को बचाने के लिए नेस्टेड फार्म का उपयोग किया है।
लेकिन सब के बाद/पहले/अद्यतन कॉलबैक पते के लिए/before_validation
के बाद के लिए कोई सुझाव के लिए छोड़कर निकाल दिया नहीं कर रहे हैं बनाने के क्यों के बाद/पहले/अद्यतन जब नेस्टेड रूप से बनाए गए कॉलबैक पते के लिए निकाल दिया जा रहा है बनाने के?
धन्यवाद
अद्यतन: मूल दस्तावेज़ पर सच मैं mongoid संस्करण 2.0.0 beta19 – Gagan