0
我有一個名爲健身房關於產品有多個where子句查詢,Rails的3
class Gym < ActiveRecord::Base
has_many :gym_users
has_many :users, :through => :gym_users
validates :name, :address1, :city, :state, :zip, :phone, :website, :presence => true
def has_admin_access?(user)
user.present? && gym_users.where(:user_id => user.id, :gym_role_id => 3)
end
end
我想修改has_admin_access方法尋找的3或4,gym_role_id另一個問題我是怎麼類我做一個小於或大於?
在某處是否存在備忘單?
所以,如果你在一個數組中傳遞多個值,它會自動創建一個聲明? – Jhorra 2011-05-22 01:25:55
是它使用數組中的in子句 – 2011-05-22 01:29:24