ruby - Conflict the key name in MongoMapper -


i use mongo mapper (0.8.6) in sinatra service. have 1 problem stack level deep. problem there conflict of key "changes" in model. here model:

class changelog   include mongomapper::document    belongs_to :resource    key :changes, hash, :required => true   key :message, string, :required => true   key :note, string   key :user_uuid, string, :required => true   key :user_name, string, :required => true   timestamps! end 

however, don't want rename key in case, it's right name web service. suggestions?

changes instance method tell fields have changed since last saved document. here's example mongomapper's documentation

user = user.create(:name => 'john', :age => 29)  puts user.changed?        # false puts user.changes.inspect # {}  user.name = 'steve' puts user.changed?            # true puts user.changes.inspect     # {"name"=>["john", "steve"]} 

unfortunately, you're going need choose different name field. maybe "adjustments" or "variations" or "differences" or "modifications"?


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -