Exception: SiteSearch::NoResults
- Defined in:
- lib/site_search/exceptions.rb
Overview
You can rescue from this error in the controller to display the error message provided or the default message
Instance Attribute Summary collapse
-
#default_message ⇒ Object
writeonly
Sets the attribute default_message.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
-
#initialize(message = nil, query = nil) ⇒ NoResults
constructor
A new instance of NoResults.
- #to_s ⇒ Object
Constructor Details
#initialize(message = nil, query = nil) ⇒ NoResults
Returns a new instance of NoResults.
19 20 21 22 23 |
# File 'lib/site_search/exceptions.rb', line 19 def initialize( = nil, query = nil) @message = @query = query @default_message = "No results for '#{@query}'" end |
Instance Attribute Details
#default_message=(value) ⇒ Object (writeonly)
Sets the attribute default_message
17 18 19 |
# File 'lib/site_search/exceptions.rb', line 17 def (value) @default_message = value end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
16 17 18 |
# File 'lib/site_search/exceptions.rb', line 16 def query @query end |
Instance Method Details
#to_s ⇒ Object
25 26 27 |
# File 'lib/site_search/exceptions.rb', line 25 def to_s @message || @default_message end |