Sha256: dd2adc378ed7bf38a7085b053be432c81c42f7cf152ef088c72bdfcd1830930f
Contents?: true
Size: 663 Bytes
Versions: 2
Compression:
Stored size: 663 Bytes
Contents
module ActsInRelation module Roles class Target < Base def define actions.each do |action| @class.class_eval <<-RUBY has_many :"#{action.pluralize}_as_target", foreign_key: :"target_#{target}_id", class_name: action.capitalize, dependent: :destroy has_many :"#{peoplize(action)}", through: :"#{action.pluralize}_as_target", source: :"#{source}" def #{pastize(action)}_by?(source) source.#{action.pluralize}.exists?(#{source}_id: source.id) end RUBY end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
acts_in_relation-0.2.1 | lib/acts_in_relation/roles/target.rb |
acts_in_relation-0.2.0 | lib/acts_in_relation/roles/target.rb |