Sha256: 2a86e68f9cd0d77e048a5b89912380f641d9efa3df24b30f1a8d2748ac802121

Contents?: true

Size: 588 Bytes

Versions: 6

Compression:

Stored size: 588 Bytes

Contents

$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
require_relative './sample_app'

MarkMapper.application.create

class User
  include MarkMapper::Document
  key :email, String
  key :admin, Boolean, :default => false

  # Only accessible or protected can be used, they cannot be used together
  attr_protected :admin
end

# protected are ignored on new/create/etc.
user = User.create(:email => 'IDontLowerCaseThings@gmail.com', :admin => true)
puts user.admin # false

# can be set using accessor
user.admin = true
user.save
puts user.admin # true

MarkMapper.application.drop

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mark_mapper-0.0.6 examples/attr_protected.rb
mark_mapper-0.0.5 examples/attr_protected.rb
mark_mapper-0.0.4 examples/attr_protected.rb
mark_mapper-0.0.3 examples/attr_protected.rb
mark_mapper-0.0.2 examples/attr_protected.rb
mark_mapper-0.0.1 examples/attr_protected.rb