Sha256: 2c420f71da20157e707b70c3986623c6bc91025dd15d40578e8ae9dc688556e3

Contents?: true

Size: 401 Bytes

Versions: 3

Compression:

Stored size: 401 Bytes

Contents

class ActiveRecord::Base 
	def self.has_tasks
		has_many :owner_tasks, class_name: 'TasksManagement::Task', foreign_key: :owner_id
		has_many :requester_tasks, class_name: 'TasksManagement::Task', foreign_key: :requester_id

		user_class = self
		TasksManagement::Task.class_eval do
			belongs_to :owner, class_name: user_class.name
			belongs_to :requester, class_name: user_class.name
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tasks_management-0.1.4 lib/tasks_management/has_tasks.rb
tasks_management-0.1.3 lib/tasks_management/has_tasks.rb
tasks_management-0.1.2 lib/tasks_management/has_tasks.rb