Create new polymorphic model Document.

This commit is contained in:
Senén Rodero Rodríguez
2017-07-20 12:08:42 +02:00
parent 3103fc3459
commit a141c82e33
7 changed files with 98 additions and 2 deletions

9
app/models/document.rb Normal file
View File

@@ -0,0 +1,9 @@
class Document < ActiveRecord::Base
belongs_to :user
belongs_to :documentable, polymorphic: true
validates :user_id, presence: true
validates :documentable_id, presence: true
validates :documentable_type, presence: true
end