diff --git a/app/models/asset.rb b/app/models/asset.rb new file mode 100644 index 0000000..19a5d0c --- /dev/null +++ b/app/models/asset.rb @@ -0,0 +1,2 @@ +class Asset < ActiveRecord::Base +end diff --git a/config/environment.rb b/config/environment.rb index bba6b67..71473a6 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -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). diff --git a/db/migrate/20100316041104_create_assets.rb b/db/migrate/20100316041104_create_assets.rb new file mode 100644 index 0000000..733d7ca --- /dev/null +++ b/db/migrate/20100316041104_create_assets.rb @@ -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 diff --git a/db/migrate/20100316041234_add_attachments_attachment_to_asset.rb b/db/migrate/20100316041234_add_attachments_attachment_to_asset.rb new file mode 100644 index 0000000..2979172 --- /dev/null +++ b/db/migrate/20100316041234_add_attachments_attachment_to_asset.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 59d802b..cabf856 100644 --- a/db/schema.rb +++ b/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" diff --git a/test/fixtures/assets.yml b/test/fixtures/assets.yml new file mode 100644 index 0000000..94d4b7f --- /dev/null +++ b/test/fixtures/assets.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +one: + assetable: + +two: + assetable: diff --git a/test/unit/asset_test.rb b/test/unit/asset_test.rb new file mode 100644 index 0000000..58aba76 --- /dev/null +++ b/test/unit/asset_test.rb @@ -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