-2
我有一個Model屬性的Model Model。 我想創建一個查詢,返回員工不在假期。用滑軌查詢
例如:
employees = Employee.where("disease = ? AND (Date.today < holidays.starts_at OR Date.today > holidays.ends_at)", false).order("engagement ASC").all
員工型號:
class Employee < ActiveRecord::Base
has_many :holidays, :dependent => :destroy
after_initialize do
self.acceso ||= true
end
end
假期型號有:starts_at, :ends_at, :employee_id
屬性