mirror of https://github.com/fspc/BikeShed-1.git
Jason Denney
12 years ago
4 changed files with 52 additions and 1 deletions
@ -1,10 +1,22 @@ |
|||||
|
require 'yaml' |
||||
|
|
||||
class TaskList < ActiveRecord::Base |
class TaskList < ActiveRecord::Base |
||||
attr_accessible :item_id, :item_type, :name |
attr_accessible :item_id, :item_type, :name |
||||
|
|
||||
belongs_to :item, :polymorphic => true |
belongs_to :item, :polymorphic => true |
||||
has_many :tasks |
has_many :tasks |
||||
|
|
||||
|
after_save :create_default_bike_tasks |
||||
|
|
||||
|
@@default_bike_tasks = YAML::load(File.open(File.join( Rails.root, "db", "defaults", "bike_tasks.yml")))["tasks"] |
||||
|
|
||||
def to_s |
def to_s |
||||
self.name |
self.name |
||||
end |
end |
||||
|
|
||||
|
def create_default_bike_tasks |
||||
|
@@default_bike_tasks.each do |task| |
||||
|
self.tasks.create( task: task, done: false) |
||||
|
end |
||||
|
end |
||||
end |
end |
||||
|
@ -0,0 +1,8 @@ |
|||||
|
tasks: |
||||
|
- Regrease Back Wheel |
||||
|
- Regrease Front Wheel |
||||
|
- Tru wheel |
||||
|
- Repack bottom bracket |
||||
|
- Repack steering post |
||||
|
- Redo brake lines |
||||
|
- Tighten brakes |
Loading…
Reference in new issue