has_one vs. defining as a Key for Embedded documents for MongoMapper and MongoDB -


स्रोत कोड है

  वर्ग RealTimeDetail में MongoMapper :: EmbeddedDocument key: url, String कुंजी: विधि, स्ट्रिंग एंड क्लास लक्ष्यफ़ाइड में MongoMapper :: Document key: name, String,: null = & gt; झूठी कुंजी: feed_type, स्ट्रिंग,: नाल = & gt; गलत है_ऑन: real_time_detail end  

जब मैं target_feed.real_time_detail = RealTimeDetail.new (: url => "",: विधि => "जाओ")

I इसके बजाय मैंने TargetFeed को

  वर्ग TargetFeed में बदल दिया है MongoMapper :: Document key: name, String,: null = & gt; झूठी कुंजी: feed_type, स्ट्रिंग,: नाल = & gt; झूठी कुंजी: real_time_detail, realtime_detail,  

यह काम करता है, लेकिन यह सोच रहा था कि क्या यह इसके बारे में जाने का सबसे अच्छा तरीका है।

आपकी कक्षाएं अब ActiveRecord से नहीं प्राप्त होती हैं, और has_one से संबंधित है ActiveRecord , इसलिए यह उपयोग के लिए उपलब्ध नहीं है एक स्पष्ट कुंजी का प्रयोग करना ऐसा लगता है कि यह काम करेगा।


Comments

Popular posts from this blog

python - rename keys in a dictionary -

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -