Sha256: b6278e216254508f3f23f411aab795c01736caf76f79e52fb26d21db07a3912f

Contents?: true

Size: 445 Bytes

Versions: 5

Compression:

Stored size: 445 Bytes

Contents

class WidgetActuality < Widget
  has_many  :items,
    :class_name => 'Actuality',
    :dependent => :destroy,
    :order => 'position'
  accepts_nested_attributes_for :items,
    :allow_destroy => true

  def get_actualities
    self.news_since.nil? ? self.items : Actuality.all(:conditions => { :created_at_gte => self.news_since })
  end

  def clone
    cloned = super
    cloned.items = self.items.map(&:clone)
    return cloned
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
forgeos_cms-1.9.5.rc1 app/models/widget_actuality.rb
forgeos_cms-1.9.4 app/models/widget_actuality.rb
forgeos_cms-1.9.2 app/models/widget_actuality.rb
forgeos_cms-1.9.1 app/models/widget_actuality.rb
forgeos_cms-1.9.0 app/models/widget_actuality.rb