Class: ActsInRelation::Roles::Action

Inherits:
Base
  • Object
show all
Defined in:
lib/acts_in_relation/roles/action.rb

Constant Summary

Constants included from Supports::Verb

Supports::Verb::PATCHES

Instance Method Summary collapse

Methods inherited from Base

#actions, #initialize, #source, #target

Methods included from Supports::Verb

#pastize, #peoplize, #progressize

Constructor Details

This class inherits a constructor from ActsInRelation::Roles::Base

Instance Method Details

#defineObject



4
5
6
7
8
9
10
11
12
# File 'lib/acts_in_relation/roles/action.rb', line 4

def define
  @class.class_eval <<-RUBY
    belongs_to :"#{source}"

    belongs_to :"target_#{target}",
      class_name: "#{target.capitalize}",
      foreign_key: :"target_#{target}_id"
  RUBY
end