Skip to content

Commit ab293a5

Browse files
committed
Add images table.
1 parent c737756 commit ab293a5

File tree

5 files changed

+33
-2
lines changed

5 files changed

+33
-2
lines changed

app/models/image.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ class Image < ActiveRecord::Base
66
:original => ['600x400', :jpg],
77
:thumbnail => ['160x160', :jpg]
88
}
9-
validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/
9+
validates_attachment_content_type :attachment, :content_type => /\Aimage\/.*\Z/
1010

1111
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class CreateImages < ActiveRecord::Migration
2+
def change
3+
create_table :images do |t|
4+
5+
t.timestamps
6+
end
7+
end
8+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class AddAttachmentToImages < ActiveRecord::Migration
2+
def self.up
3+
add_attachment :images, :attachment
4+
end
5+
6+
def self.down
7+
remove_attachment :images, :attachment
8+
end
9+
end

db/schema.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# It's strongly recommended to check this file into your version control system.
1313

14-
ActiveRecord::Schema.define(:version => 20131031122342) do
14+
ActiveRecord::Schema.define(:version => 20140508131814) do
1515

1616
create_table "attendances", :force => true do |t|
1717
t.integer "user_id", :null => false
@@ -35,6 +35,15 @@
3535
t.datetime "updated_at", :null => false
3636
end
3737

38+
create_table "images", :force => true do |t|
39+
t.datetime "created_at", :null => false
40+
t.datetime "updated_at", :null => false
41+
t.string "attachment_file_name"
42+
t.string "attachment_content_type"
43+
t.integer "attachment_file_size"
44+
t.datetime "attachment_updated_at"
45+
end
46+
3847
create_table "outputs", :force => true do |t|
3948
t.text "input_type"
4049
t.text "output"

spec/models/image_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
require 'spec_helper'
2+
3+
describe Image do
4+
pending "add some examples to (or delete) #{__FILE__}"
5+
end

0 commit comments

Comments
 (0)