Module: Redmine::Search::Controller::ClassMethods
- Defined in:
- lib/redmine/search.rb
Constant Summary
- @@default_search_scopes =
Hash.new {|hash, key| hash[key] = {:default => nil, :actions => {}}}
Instance Method Summary collapse
-
#default_search_scope(id, options = {}) ⇒ Object
Set the default search scope for a controller or specific actions Examples: * search_scope :issues # => sets the search scope to :issues for the whole controller * search_scope :issues, :only => :index * search_scope :issues, :only => [:index, :show].
Instance Method Details
#default_search_scope(id, options = {}) ⇒ Object
Set the default search scope for a controller or specific actions Examples:
* search_scope :issues # => sets the search scope to :issues for the whole controller
* search_scope :issues, :only => :index
* search_scope :issues, :only => [:index, :show]
152 153 154 155 156 157 158 159 |
# File 'lib/redmine/search.rb', line 152 def default_search_scope(id, = {}) if actions = [:only] actions = [] << actions unless actions.is_a?(Array) actions.each {|a| default_search_scopes[controller_name.to_sym][:actions][a.to_sym] = id.to_s} else default_search_scopes[controller_name.to_sym][:default] = id.to_s end end |