Sha256: f77419f84049f25cb0ab6ece2ba5ac3ad5637dcabad5a872ef71994ce0d51736
Contents?: true
Size: 491 Bytes
Versions: 8
Compression:
Stored size: 491 Bytes
Contents
class Kithe::Work < Kithe::Model # Works 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 = "work" if self.kithe_model_type.nil? end before_validation do self.kithe_model_type = "work" if self.kithe_model_type.nil? end end
Version data entries
8 entries across 8 versions & 1 rubygems