Product モデルに次のメソッドがあります。
def has_feature? (feature_name)
self.features.where(:name=>feature_name).present?
end
これは非常に遅いようです。製品に特定の名前の機能があるかどうかを確認するより良い方法はありますか?
Product モデルに次のメソッドがあります。
def has_feature? (feature_name)
self.features.where(:name=>feature_name).present?
end
これは非常に遅いようです。製品に特定の名前の機能があるかどうかを確認するより良い方法はありますか?