class Idea < ActiveRecord::Base
attr_accessible :archived, :checked, :content, :note, :stared
scope :stared, -> { where(stared: true)
end
このコードでは、スコープ ( などstared
) が で定義されているかどうかをテストするにはどうすればよいでしょうかIdea
。こんな効果が欲しい
Idea.has_scope?(:stared)
=> true
Idea.has_scope?(:unknown)
=> false