Class: Job
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Job
- 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
-
#notify_users ⇒ Object
validates_length_of :name, :within => 3..30 validates_uniqueness_of :name, :scope => :organization.
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_users ⇒ Object
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 |