Create new polymorphic model Document.
This commit is contained in:
9
app/models/document.rb
Normal file
9
app/models/document.rb
Normal 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
|
||||
Reference in New Issue
Block a user