Module: AppFrame::ControllerMethods::SearchSupport
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/app_frame/controller_methods.rb
Instance Method Summary collapse
Instance Method Details
#end_of_association_chain ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/app_frame/controller_methods.rb', line 48 def end_of_association_chain chain = super return chain if chain.is_a?(ActiveRecord::Base) #|| chain.is_a?(Array) chain = chain.with_query(params[:q]) if params[:q].present? && searchable? if params[:tags].present? = {} [:any] = true if params[:match] == 'any' chain = chain.tagged_with(params[:tags], ) end chain = chain.send(list_scope) if resource_class.respond_to?(list_scope) chain end |
#list_scope ⇒ Object
44 45 46 |
# File 'lib/app_frame/controller_methods.rb', line 44 def list_scope @list_scope ||= (controller_namespaces.map(&:to_s).join("_") + "_list").to_sym end |
#searchable? ⇒ Boolean
40 41 42 |
# File 'lib/app_frame/controller_methods.rb', line 40 def searchable? resource_class.respond_to?(:with_query) end |