Ruby on Rails 3.2.2 と Squeel gem を使用しています。OR
複数のスコープ メソッドを使用して、それらのスコープ メソッドの SQL 条件に関連する句を含むSQL クエリを生成する方法があるかどうかを知りたいです。つまり、私は持っています:
class Article < ActiveRecord::Base
def self.scope_method_1
... # scope_method_1 SQL conditions
end
def self.scope_method_2
... # scope_method_2 SQL conditions
end
def self.scope_method_combination
# I am looking for something like
#
# where{scope_method_1 | scope_method_2} # Note: The '|' means the SQL 'OR' clause in the Squeel context
#
# so to generate the following SQL query:
#
# SELECT FROM articles WHERE <scope_method_1 SQL conditions> OR <scope_method_2 SQL conditions>
end
end
スコープ メソッドを使用してSQLOR
句を生成することは可能ですか (Squeel gem を使用するかどうかによって)?