Sha256: 1b77a2881e9f232490e02c89c851ffb9dd6d72317754ced455586303da9cb37c

Contents?: true

Size: 427 Bytes

Versions: 1

Compression:

Stored size: 427 Bytes

Contents

MongoMapper.connection = Mongo::Connection.new('127.0.0.1')
MongoMapper.database = "testing_versioned"

class User
  include MongoMapper::Document
  include Versioned
  key :first_name, String
  key :last_name, String
  timestamps!
  
  def name
    [first_name, last_name].compact.join(' ')
  end

  def name=(names)
    self[:first_name], self[:last_name] = names.split(' ', 2)
  end
end

User.destroy_all
Version.destroy_all

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
versioned-0.1.0 test/schema.rb