Class: InvoiceBar::SearchController

Inherits:
ApplicationController show all
Defined in:
app/controllers/invoice_bar/search_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/invoice_bar/search_controller.rb', line 5

def index
  @invoices = []
  @receipts = []
  @invoice_templates = []
  @receipt_templates = []
  @contacts = []

  if params[:search]
    query = params[:search]

    @invoices = current_user.invoices.search_for(query)
    @receipts = current_user.receipts.search_for(query)
    @invoice_templates = current_user.invoice_templates.search_for(query)
    @receipt_templates = current_user.receipt_templates.search_for(query)
    @contacts = current_user.contacts.search_for(query)
  end
end