Sha256: 8b044e7a09f70ff18ba10253a835ff21df84bc09f0fbe9bbf40db1ce88788cc2

Contents?: true

Size: 515 Bytes

Versions: 8

Compression:

Stored size: 515 Bytes

Contents

class Kithe::Collection < Kithe::Model
  # Collections don't have derivatives, but we want to allow Rails eager loading
  # of association on hetereogenous fetches of Kithe::Model, so this is clever.
  has_many :derivatives, -> { none }
  private :derivatives, :derivatives=, :derivative_ids, :derivative_ids=

  after_initialize do
    self.kithe_model_type = "collection" if self.kithe_model_type.nil?
  end
  before_validation do
    self.kithe_model_type = "collection" if self.kithe_model_type.nil?
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kithe-2.0.0.pre.alpha2 app/models/kithe/collection.rb
kithe-2.0.0.pre.alpha1 app/models/kithe/collection.rb
kithe-1.1.2 app/models/kithe/collection.rb
kithe-1.1.1 app/models/kithe/collection.rb
kithe-1.1.0 app/models/kithe/collection.rb
kithe-1.0.0 app/models/kithe/collection.rb
kithe-0.3.0 app/models/kithe/collection.rb
kithe-0.2.0 app/models/kithe/collection.rb