Add ImageUpload model

This commit is contained in:
Andrew Brown 2017-02-16 21:20:55 +00:00
parent 77245b53e1
commit eec596133b
4 changed files with 40 additions and 1 deletions

View File

@ -0,0 +1,3 @@
class ImageUpload < ActiveRecord::Base
belongs_to :user
end

View File

@ -0,0 +1,12 @@
class CreateImageUploads < ActiveRecord::Migration
def change
create_table :image_uploads do |t|
t.string :privacy
t.references :user, index: true, foreign_key: true
t.string :content_type
t.integer :content_id
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,9 @@
class AddSrcToImageUploads < ActiveRecord::Migration
def self.up
add_attachment :image_uploads, :src
end
def self.down
remove_attachment :image_uploads, :src
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170201151923) do
ActiveRecord::Schema.define(version: 20170216211914) do
create_table "archenemyships", force: :cascade do |t|
t.integer "user_id"
@ -295,6 +295,21 @@ ActiveRecord::Schema.define(version: 20170201151923) do
t.integer "headquarter_id"
end
create_table "image_uploads", force: :cascade do |t|
t.string "privacy"
t.integer "user_id"
t.string "content_type"
t.integer "content_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "src_file_name"
t.string "src_content_type"
t.integer "src_file_size"
t.datetime "src_updated_at"
end
add_index "image_uploads", ["user_id"], name: "index_image_uploads_on_user_id"
create_table "items", force: :cascade do |t|
t.string "name", null: false
t.string "item_type"