added asset model

This commit is contained in:
scott 2010-03-16 00:37:29 -04:00
parent b5c15da9ff
commit cf058d356b
7 changed files with 55 additions and 1 deletions

2
app/models/asset.rb Normal file
View File

@ -0,0 +1,2 @@
class Asset < ActiveRecord::Base
end

View File

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

View 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

View File

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

View File

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