Sha256: 058c017c4643e498b4908be4ebe0dd5dcf7abc8546f08172a89520abb0f9c522
Contents?: true
Size: 872 Bytes
Versions: 4
Compression:
Stored size: 872 Bytes
Contents
# @private class Skyline::Publication < Skyline::ArticleVersion belongs_to :variant, :class_name => "Skyline::Variant" default_scope :order => "created_at DESC" named_scope :with_variant, {:conditions => "variant_id IS NOT NULL"} def published? self.article.published_publication == self end # variant_attributes: an Hash of attributes for a new Variant # required: variant_attributes[:name] # def rollback(variant_attributes) raise ArgumentError, "variant_attributes must be an Hash" unless variant_attributes.kind_of?(Hash) raise ArgumentError, "variant_attributes['name'] expected" unless variant_attributes.include?('name') variant = self.clone_to_class(self.article.variants) variant.attributes = variant_attributes variant.variant_id = nil variant.save variant end end
Version data entries
4 entries across 4 versions & 2 rubygems