Class: Job

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/job.rb

Overview

Schema Information

Table name: jobs

id              :integer          not null, primary key
organization_id :integer
name            :string(255)
created_at      :datetime
updated_at      :datetime
color           :string(255)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.employee_jobs(users, org_id) ⇒ Object



28
29
30
31
32
33
34
35
# File 'app/models/job.rb', line 28

def self.employee_jobs users, org_id
  users = User.where(id: users).includes(:jobs)
	jobs = {}
	users.each do |user|
		jobs[user.id] = user.jobs.where(:organization_id => org_id)
	end
	jobs
end

Instance Method Details

#notify_usersObject

validates_length_of :name, :within => 3..30 validates_uniqueness_of :name, :scope => :organization



24
25
26
# File 'app/models/job.rb', line 24

def notify_users
  Pusher.trigger(self.organization.name, 'jobchange', {:message => ''})
end