Module: PgSearch::Model
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/pg_search/model.rb', line 31 def method_missing(symbol, *args) case symbol when :pg_search_rank raise PgSearchRankNotSelected unless respond_to?(:pg_search_rank) read_attribute(:pg_search_rank).to_f when :pg_search_highlight raise PgSearchHighlightNotSelected unless respond_to?(:pg_search_highlight) read_attribute(:pg_search_highlight) else super end end |
Instance Method Details
#respond_to_missing?(symbol, *args) ⇒ Boolean
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/pg_search/model.rb', line 46 def respond_to_missing?(symbol, *args) case symbol when :pg_search_rank attributes.key?(:pg_search_rank) when :pg_search_highlight attributes.key?(:pg_search_highlight) else super end end |