Sha256: 3df9d1ba3f71c959711eb0417d9d37314fa9d09096238c33be41b03f3912aeb1

Contents?: true

Size: 499 Bytes

Versions: 8

Compression:

Stored size: 499 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

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

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
mongoid-paranoia-1.1.0 spec/app/models/name.rb
mongoid-paranoia-1.0.1 spec/app/models/name.rb
mongoid-paranoia-1.0.0 spec/app/models/name.rb
mongoid-versioning-1.0.0 spec/app/models/name.rb
mongoid-paranoia-1.0.0.beta2 spec/app/models/name.rb
mongoid-versioning-1.0.0.beta2 spec/app/models/name.rb
mongoid-paranoia-1.0.0.beta1 spec/app/models/name.rb
mongoid-versioning-1.0.0.beta1 spec/app/models/name.rb