Displaying 1 result from an estimated 1 matches for "existing_schedule_attributes".
2009 Oct 06
1
Problems Processing multiple form elements generated by javascript actions
...t; :update
after_update :save_schedules
  accepts_nested_attributes_for :schedules, :allow_destroy => :true,
      :reject_if => :all_blank
  def new_schedule_attributes=(schedule_attributes)
    schedule_attributes.each do |attributes|
      schedules.build(attributes)
    end
  end
  def existing_schedule_attributes=(schedule_attributes)
    schedules.reject(&:new_record?).each do |schedule|
      attributes = schedule_attributes[schedule.id.to_s]
      if attributes
        schedule.attributes = attributes
      else
        schedules.delete(schedule)
      end
    end
  end
  def save_schedules
    sche...