Module: Diaspora::Fields::Target

Included in:
Like, Participation
Defined in:
lib/diaspora/fields/target.rb

Class Method Summary collapse

Class Method Details

.included(model) ⇒ Object


6
7
8
9
10
11
12
# File 'lib/diaspora/fields/target.rb', line 6

def self.included(model)
  model.class_eval do
    belongs_to :target, polymorphic: true

    validates :target_id, uniqueness: {scope: %i(target_type author_id)}
  end
end