Skip to content
Browse files

adds changes to items

  • Loading branch information...
1 parent 9ef3190 commit c5d8f5f07064b3e2754055c0390197bdee7011ce @chaserx chaserx committed Jul 21, 2012
Showing with 23 additions and 1 deletion.
  1. +3 −1 app/models/item.rb
  2. +9 −0 db/migrate/20120722025111_change_type_on_items.rb
  3. +11 −0 db/seeds.rb
View
4 app/models/item.rb
@@ -1,8 +1,10 @@
class Item < ActiveRecord::Base
has_paper_trail
+ # NOTE(chase): I know this is wrong but here for test.
+ # TODO(chase): Protect the attributes.
attr_accessible :time_checked_in, :time_checked_out, :checked_out_by,
- :date_collected, :name, :tag_number, :type, :desc,
+ :date_collected, :name, :tag_number, :item_type, :desc,
:checkedin, :checkedout, :donated_by, :maintained_by
before_create :set_defaults
View
9 db/migrate/20120722025111_change_type_on_items.rb
@@ -0,0 +1,9 @@
+class ChangeTypeOnItems < ActiveRecord::Migration
+ def up
+ rename_column :items, :type, :item_type
+ end
+
+ def down
+ rename_column :items, :item_type, :type
+ end
+end
View
11 db/seeds.rb
@@ -5,3 +5,14 @@
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
+if Item.create!(
+ {
+ name: "Hammer",
+ date_collected: Time.now,
+ time_checked_in: Time.now,
+ item_type: "Tool",
+ desc: "16 oz, Oak handle",
+ donated_by: "Chase Southard",
+ maintained_by: ""
+ }
+) then puts "Created some items." end

0 comments on commit c5d8f5f

Please sign in to comment.
Something went wrong with that request. Please try again.