added asset model
This commit is contained in:
parent
b5c15da9ff
commit
cf058d356b
2
app/models/asset.rb
Normal file
2
app/models/asset.rb
Normal file
@ -0,0 +1,2 @@
|
||||
class Asset < ActiveRecord::Base
|
||||
end
|
@ -26,6 +26,7 @@ Rails::Initializer.run do |config|
|
||||
config.gem 'formtastic'
|
||||
config.gem 'faker'
|
||||
config.gem 'mysql'
|
||||
config.gem 'paperclip'
|
||||
config.gem "matthuhiggins-foreigner", :lib => "foreigner", :source => "http://gemcutter.org"
|
||||
config.gem 'rack-validate'
|
||||
# Only load the plugins named here, in the order given (default is alphabetical).
|
||||
|
12
db/migrate/20100316041104_create_assets.rb
Normal file
12
db/migrate/20100316041104_create_assets.rb
Normal file
@ -0,0 +1,12 @@
|
||||
class CreateAssets < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :assets do |t|
|
||||
t.polymorphic :assetable
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :assets
|
||||
end
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
class AddAttachmentsAttachmentToAsset < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :assets, :attachment_file_name, :string
|
||||
add_column :assets, :attachment_content_type, :string
|
||||
add_column :assets, :attachment_file_size, :integer
|
||||
add_column :assets, :attachment_updated_at, :datetime
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :assets, :attachment_file_name
|
||||
remove_column :assets, :attachment_content_type
|
||||
remove_column :assets, :attachment_file_size
|
||||
remove_column :assets, :attachment_updated_at
|
||||
end
|
||||
end
|
11
db/schema.rb
11
db/schema.rb
@ -9,7 +9,16 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20100312004836) do
|
||||
ActiveRecord::Schema.define(:version => 20100316041234) do
|
||||
|
||||
create_table "assets", :force => true do |t|
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "attachment_file_name"
|
||||
t.string "attachment_content_type"
|
||||
t.integer "attachment_file_size"
|
||||
t.datetime "attachment_updated_at"
|
||||
end
|
||||
|
||||
create_table "projects", :force => true do |t|
|
||||
t.string "name"
|
||||
|
7
test/fixtures/assets.yml
vendored
Normal file
7
test/fixtures/assets.yml
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
||||
|
||||
one:
|
||||
assetable:
|
||||
|
||||
two:
|
||||
assetable:
|
8
test/unit/asset_test.rb
Normal file
8
test/unit/asset_test.rb
Normal file
@ -0,0 +1,8 @@
|
||||
require 'test_helper'
|
||||
|
||||
class AssetTest < ActiveSupport::TestCase
|
||||
# Replace this with your real tests.
|
||||
test "the truth" do
|
||||
assert true
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user