Class: Wco::Api::LeadsController
- Inherits:
-
Wco::ApiController
- Object
- Wco::ApiController
- Wco::Api::LeadsController
- Defined in:
- app/controllers/wco/api/leads_controller.rb
Instance Method Summary collapse
- #by_email ⇒ Object
-
#index ⇒ Object
select2-leads-ajax.
- #index_hash ⇒ Object
Instance Method Details
#by_email ⇒ Object
7 8 9 |
# File 'app/controllers/wco/api/leads_controller.rb', line 7 def by_email @lead = Wco::Lead.where( email: params[:email] ).first end |
#index ⇒ Object
select2-leads-ajax
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/wco/api/leads_controller.rb', line 12 def index :index, Wco::Lead @leads = Wco::Lead.all if params[:q].present? q = params[:q].downcase @leads = @leads.any_of( { email: /#{q}/i }, { name: /#{q}/i }, ); end end |