Sha256: 5a4fc40799042e9c3f6f35a52f496ac34268e3fcca64b775c47e8b423f886e62
Contents?: true
Size: 614 Bytes
Versions: 3
Compression:
Stored size: 614 Bytes
Contents
# @private class Skyline::Sections::LinkSection < ActiveRecord::Base include Skyline::Sections::Interface include NestedAttributesPositioning has_many :links, :class_name => "Skyline::LinkSectionLink", :dependent => :destroy validate :has_at_least_one_link accepts_nested_attributes_for :links, :allow_destroy => true def clone returning super do |clone| clone.links = self.links.collect{|link| link.clone} end end protected def has_at_least_one_link self.errors.add(:links, :no_links) unless self.links.detect{|link| !link.marked_for_destruction?} end end
Version data entries
3 entries across 3 versions & 2 rubygems