Unless you completely change the structure of the code, no.
, , , . , , , . , . , , , , , .
, , , , :
class Article < ActiveRecord::Base
SEARCH_BY_TITLE=lambda {|obj, search| obj.where('articles.title LIKE ?', "%#{search}%")}
def self.search_by_title(search)
SEARCH_BY_TITLE.call(self, search)
end
end
class ArticleAssociation < ActiveRecord::Base
def self.search_by_article_title(search)
Article::SEARCH_BY_TITLE.call(joins(:article),search)
end
end
lambda , where . .
. , , lambdas, , Ruby. , .