From 973567bfdcaade82b05bb9f956816e9bba8daec9 Mon Sep 17 00:00:00 2001 From: Ryan Clark Date: Wed, 17 Jul 2013 18:10:49 -0700 Subject: [PATCH] Remane use_by to plant_before to humor Skud --- app/models/seed.rb | 2 +- app/views/seeds/_form.html.haml | 2 +- app/views/seeds/index.html.haml | 4 ++-- app/views/seeds/show.html.haml | 4 ++-- ...18005600_change_use_by_to_plant_before_on_seed.rb | 5 +++++ db/schema.rb | 12 ++++++------ spec/factories/seeds.rb | 2 +- 7 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 db/migrate/20130718005600_change_use_by_to_plant_before_on_seed.rb diff --git a/app/models/seed.rb b/app/models/seed.rb index c271678b4..33c017b8f 100644 --- a/app/models/seed.rb +++ b/app/models/seed.rb @@ -1,5 +1,5 @@ class Seed < ActiveRecord::Base - attr_accessible :owner_id, :crop_id, :description, :quantity, :use_by + attr_accessible :owner_id, :crop_id, :description, :quantity, :plant_before belongs_to :crop belongs_to :owner, :class_name => 'Member', :foreign_key => 'owner_id' end diff --git a/app/views/seeds/_form.html.haml b/app/views/seeds/_form.html.haml index e17719fd7..9c86be1b5 100644 --- a/app/views/seeds/_form.html.haml +++ b/app/views/seeds/_form.html.haml @@ -18,6 +18,6 @@ = f.number_field :quantity, :class => 'input-small' .control-group = f.label 'Use by:', :class => 'control-label' - .controls= f.text_field :use_by, :value => @seed.use_by ? @seed.use_by.to_s(:ymd) : '', :class => 'add-datepicker' + .controls= f.text_field :plant_before, :value => @seed.plant_before ? @seed.plant_before.to_s(:ymd) : '', :class => 'add-datepicker' .form-actions = f.submit 'Save', :class => 'btn btn-primary' diff --git a/app/views/seeds/index.html.haml b/app/views/seeds/index.html.haml index abdabdb4e..23ab923aa 100644 --- a/app/views/seeds/index.html.haml +++ b/app/views/seeds/index.html.haml @@ -17,7 +17,7 @@ %th Crop %th Description %th Quantity - %th Use by + %th Plant before %th - @seeds.each do |seed| @@ -26,7 +26,7 @@ %td= link_to seed.crop.system_name, seed.crop %td= seed.description %td= seed.quantity - %td= seed.use_by + %td= seed.plant_before %td= link_to 'Details', seed, :class => 'btn btn-mini' - else %p There are no seeds to display. diff --git a/app/views/seeds/show.html.haml b/app/views/seeds/show.html.haml index 4b6dfa6e5..f072898e6 100644 --- a/app/views/seeds/show.html.haml +++ b/app/views/seeds/show.html.haml @@ -6,8 +6,8 @@ %b Quantity: = @seed.quantity.blank? ? "not specified" : @seed.quantity %p - %b Use by: - = @seed.use_by.to_s + %b Plant before: + = @seed.plant_before.to_s %p %b Description: diff --git a/db/migrate/20130718005600_change_use_by_to_plant_before_on_seed.rb b/db/migrate/20130718005600_change_use_by_to_plant_before_on_seed.rb new file mode 100644 index 000000000..23ffefaf9 --- /dev/null +++ b/db/migrate/20130718005600_change_use_by_to_plant_before_on_seed.rb @@ -0,0 +1,5 @@ +class ChangeUseByToPlantBeforeOnSeed < ActiveRecord::Migration + def change + rename_column :seeds, :use_by, :plant_before + end +end diff --git a/db/schema.rb b/db/schema.rb index a805a5b48..3a99425f8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130715110134) do +ActiveRecord::Schema.define(:version => 20130718005600) do create_table "account_types", :force => true do |t| t.string "name", :null => false @@ -235,13 +235,13 @@ ActiveRecord::Schema.define(:version => 20130715110134) do end create_table "seeds", :force => true do |t| - t.integer "owner_id", :null => false - t.integer "crop_id", :null => false + t.integer "owner_id", :null => false + t.integer "crop_id", :null => false t.text "description" t.integer "quantity" - t.date "use_by" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.date "plant_before" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end end diff --git a/spec/factories/seeds.rb b/spec/factories/seeds.rb index aeb2abe0d..467f01ef3 100644 --- a/spec/factories/seeds.rb +++ b/spec/factories/seeds.rb @@ -6,6 +6,6 @@ FactoryGirl.define do crop description "MyText" quantity 1 - use_by "2013-07-15" + plant_before "2013-07-15" end end