Class: ActiveScaffold::Config::Search
- Defined in:
- lib/active_scaffold/config/search.rb
Constant Summary collapse
- @@link =
ActiveScaffold::DataStructures::ActionLink.new('show_search', :label => :search, :type => :collection, :security_method => :search_authorized?, :ignore_method => :search_ignore?)
- @@text_search =
:full
- @@split_terms =
' '
Constants inherited from Base
Instance Attribute Summary collapse
-
#link ⇒ Object
the ActionLink for this action.
-
#live ⇒ Object
writeonly
whether submits the search as you type.
-
#reset_form ⇒ Object
Returns the value of attribute reset_form.
-
#split_terms ⇒ Object
Returns the value of attribute split_terms.
-
#text_search ⇒ Object
A flag for how the search should do full-text searching in the database: * :full: LIKE %?% * :start: LIKE ?% * :end: LIKE %? * false: LIKE ? Default is :full.
Attributes inherited from Base
#action_group, #core, #formats, #user_settings_key
Class Method Summary collapse
Instance Method Summary collapse
-
#columns ⇒ Object
provides access to the list of columns specifically meant for the Search to use.
-
#initialize(core_config) ⇒ Search
constructor
A new instance of Search.
- #live? ⇒ Boolean
Methods inherited from Base
#crud_type, inherited, #label, #model_id, #new_user_settings, #setup_user_setting_key, #user
Methods included from ActiveScaffold::Configurable
#configure, #method_missing, #respond_to_missing?
Constructor Details
#initialize(core_config) ⇒ Search
Returns a new instance of Search.
5 6 7 8 9 10 11 |
# File 'lib/active_scaffold/config/search.rb', line 5 def initialize(core_config) super @text_search = self.class.text_search @live = self.class.live? @split_terms = self.class.split_terms @reset_form = self.class.reset_form end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveScaffold::Configurable
Instance Attribute Details
#link ⇒ Object
the ActionLink for this action
65 66 67 |
# File 'lib/active_scaffold/config/search.rb', line 65 def link @link end |
#live=(value) ⇒ Object (writeonly)
whether submits the search as you type
68 69 70 |
# File 'lib/active_scaffold/config/search.rb', line 68 def live=(value) @live = value end |
#reset_form ⇒ Object
Returns the value of attribute reset_form.
62 63 64 |
# File 'lib/active_scaffold/config/search.rb', line 62 def reset_form @reset_form end |
#split_terms ⇒ Object
Returns the value of attribute split_terms.
60 61 62 |
# File 'lib/active_scaffold/config/search.rb', line 60 def split_terms @split_terms end |
#text_search ⇒ Object
A flag for how the search should do full-text searching in the database:
-
:full: LIKE %?%
-
:start: LIKE ?%
-
:end: LIKE %?
-
false: LIKE ?
Default is :full
58 59 60 |
# File 'lib/active_scaffold/config/search.rb', line 58 def text_search @text_search end |
Class Method Details
.live? ⇒ Boolean
30 31 32 |
# File 'lib/active_scaffold/config/search.rb', line 30 def self.live? @@live end |
Instance Method Details
#columns ⇒ Object
provides access to the list of columns specifically meant for the Search to use
43 44 45 46 47 48 49 |
# File 'lib/active_scaffold/config/search.rb', line 43 def columns # we want to delay initializing to the @core.columns set for as long as possible. Too soon and .search_sql will not be available to .searchable? unless defined? @columns self.columns = @core.columns.collect { |c| c.name if @core.columns._inheritable.include?(c.name) && c.searchable? && c.association.nil? && c.text? }.compact end @columns end |
#live? ⇒ Boolean
69 70 71 |
# File 'lib/active_scaffold/config/search.rb', line 69 def live? @live end |