Sha256: 2fbbb26656acddbae98c825c7872fe6f99f6a0e2b7162eca4a39378a0f15a467

Contents?: true

Size: 527 Bytes

Versions: 10

Compression:

Stored size: 527 Bytes

Contents

class Name
  include Mongoid::Document

  field :_id, type: String, default: ->{
    "#{first_name}-#{last_name}"
  }

  field :first_name, type: String
  field :last_name, type: String
  field :parent_title, type: String

  embeds_many :translations, validate: false
  embeds_one :language, as: :translatable, validate: false
  embedded_in :namable, polymorphic: true

  accepts_nested_attributes_for :language

  attr_protected :_id, :id

  def set_parent=(set = false)
    self.parent_title = namable.title if set
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
mongoid-3.1.7 spec/app/models/name.rb
mongoid-3.1.6 spec/app/models/name.rb
mongoid-3.1.5 spec/app/models/name.rb
mongoid-paranoia-0.3.0 spec/app/models/name.rb
mongoid-paranoia-0.2.1 spec/app/models/name.rb
mongoid-versioning-0.2.0 spec/app/models/name.rb
mongoid-paranoia-0.2.0 spec/app/models/name.rb
mongoid-paranoia-0.1.1 spec/app/models/name.rb
mongoid-versioning-0.1.0 spec/app/models/name.rb
mongoid-paranoia-0.1.0 spec/app/models/name.rb