Skip to content
Browse files

add in base document model

  • Loading branch information...
1 parent 669240b commit f458ca5b36d81b0fddeaf30a8a25f4dc351c8d79 @jackdempsey committed Aug 5, 2012
View
6 app/models/documents/document.rb
@@ -0,0 +1,6 @@
+module Documents
+ class Document < ActiveRecord::Base
+ belongs_to :owner, polymorphic: true
+ attr_accessible :file, :owner, :owner_id, :owner_type
+ end
+end
View
11 db/migrate/20120805175417_create_documents_documents.rb
@@ -0,0 +1,11 @@
+class CreateDocumentsDocuments < ActiveRecord::Migration
+ def change
+ create_table :documents_documents do |t|
+ t.string :file
+ t.references :owner, polymorphic: true
+
+ t.timestamps
+ end
+ add_index :documents_documents, :owner_id
+ end
+end
View
5 spec/models/documents/document_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Document do
+ pending "add some examples to (or delete) #{__FILE__}"
+end

0 comments on commit f458ca5

Please sign in to comment.
Something went wrong with that request. Please try again.