Remane use_by to plant_before to humor Skud

This commit is contained in:
Ryan Clark
2013-07-17 18:10:49 -07:00
parent 454e7ceb3d
commit 973567bfdc
7 changed files with 18 additions and 13 deletions

View File

@@ -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

View File

@@ -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'

View File

@@ -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.

View File

@@ -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:

View File

@@ -0,0 +1,5 @@
class ChangeUseByToPlantBeforeOnSeed < ActiveRecord::Migration
def change
rename_column :seeds, :use_by, :plant_before
end
end

View File

@@ -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

View File

@@ -6,6 +6,6 @@ FactoryGirl.define do
crop
description "MyText"
quantity 1
use_by "2013-07-15"
plant_before "2013-07-15"
end
end