Sha256: 52aa916389222c0e884e24d8f3cb34490c3f95aab6b72800ec19fc3196862305

Contents?: true

Size: 564 Bytes

Versions: 1

Compression:

Stored size: 564 Bytes

Contents

class Eventable::OpeningTimelist

  attr_reader :opening_period, :items
  delegate :id, :save, :to => :opening_period

  def initialize(opening_period)
    @opening_period = opening_period
    @items = opening_period.opening_times.all
  end

  def errors
    ActiveRecord::Errors.new(self)
  end

  def add_blank
    @items << @opening_period.opening_times.build
  end

  def items_attributes=(attr)
    @opening_period.opening_times_attributes=(attr)
  end

  def update_attributes(attrs)
    attrs.each do |k,v|
      send "#{k}=", v
    end
    save
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dcs-eventable-0.0.8 app/models/eventable/opening_timelist.rb