Class: ActiveScaffold::Config::FieldSearch
- Defined in:
- lib/active_scaffold/config/field_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
Instance Attribute Summary collapse
-
#default_params ⇒ Object
default search params default_params = => {“from”=>“test”, “to”=>“”, “opt”=>“%?%”}.
-
#human_conditions ⇒ Object
human conditions instead of just filtered you may show the user a humanized search condition statment.
-
#link ⇒ Object
the ActionLink for this action.
-
#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
Instance Method Summary collapse
-
#columns ⇒ Object
provides access to the list of columns specifically meant for the Search to use.
-
#initialize(core_config) ⇒ FieldSearch
constructor
A new instance of FieldSearch.
- #optional_columns ⇒ Object
-
#optional_columns=(optionals) ⇒ Object
rarely searched columns may be placed in a hidden subgroup.
Methods inherited from Base
#crud_type, #formats, #formats=, inherited
Methods included from ActiveScaffold::Configurable
Constructor Details
#initialize(core_config) ⇒ FieldSearch
Returns a new instance of FieldSearch.
5 6 7 8 9 10 11 12 13 |
# File 'lib/active_scaffold/config/field_search.rb', line 5 def initialize(core_config) @core = core_config @text_search = self.class.text_search # start with the ActionLink defined globally @link = self.class.link.clone @action_group = self.class.action_group.clone if self.class.action_group end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveScaffold::Configurable
Instance Attribute Details
#default_params ⇒ Object
default search params default_params = => {“from”=>“test”, “to”=>“”, “opt”=>“%?%”}
68 69 70 |
# File 'lib/active_scaffold/config/field_search.rb', line 68 def default_params @default_params end |
#human_conditions ⇒ Object
human conditions instead of just filtered you may show the user a humanized search condition statment
72 73 74 |
# File 'lib/active_scaffold/config/field_search.rb', line 72 def human_conditions @human_conditions end |
#link ⇒ Object
the ActionLink for this action
55 56 57 |
# File 'lib/active_scaffold/config/field_search.rb', line 55 def link @link 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
52 53 54 |
# File 'lib/active_scaffold/config/field_search.rb', line 52 def text_search @text_search end |
Instance Method Details
#columns ⇒ Object
provides access to the list of columns specifically meant for the Search to use
35 36 37 38 39 40 41 42 |
# File 'lib/active_scaffold/config/field_search.rb', line 35 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 @columns self.columns = @core.columns._inheritable self.columns.exclude @core.columns.active_record_class.locking_column.to_sym end @columns end |
#optional_columns ⇒ Object
62 63 64 |
# File 'lib/active_scaffold/config/field_search.rb', line 62 def optional_columns @optional_columns ||= [] end |