Skip to content
Snippets Groups Projects
Commit 8bcc56a0 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Database and model for RecurringItemRange

parent 83a336be
No related branches found
No related tags found
No related merge requests found
class RecurringItem < ActiveRecord::Base
belongs_to :schedule
has_many :recurring_item_ranges
end
class RecurringItemRange < ActiveRecord::Base
belongs_to :recurring_item
end
# -*- coding: utf-8 -*-
class CreateRecurringItemRanges < ActiveRecord::Migration
def self.up
create_table :recurring_item_ranges do |t|
# t.column :name, :string
t.column :recurring_item_id, :integer
t.column :amount, :integer
t.column :startdate, :date
t.column :enddate, :date
t.column :schedule_id, :integer
end
pay = RecurringItem.find_by_description("Pers lön")
telia = RecurringItem.find_by_description("Telia")
month = Schedule.find_by_name("Månad")
quarter = Schedule.find_by_name("Kvartal")
RecurringItemRange.create(:recurring_item_id => pay.id,
:amount => "22200",
:startdate => Date.civil(2006, 8, 25),
:schedule_id => month.id)
RecurringItemRange.create(:recurring_item_id => telia.id,
:amount => "-1200",
:startdate => Date.civil(2006, 9, 10),
:schedule_id => quarter.id)
end
def self.down
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment