Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. class Transaction < ActiveRecord::Base
  2. ...
  3.  
  4. searchable do
  5. text :description
  6. integer :id
  7. float :amount
  8. end
  9.  
  10. ...
  11. end
  12.  
  13. def search
  14. @search = Transaction.search do
  15. any_of do
  16. with(:amount, params[:search])
  17. with(:id, params[:search])
  18. fulltext(params[:search])
  19. end
  20. end
  21.  
  22. @transactions = @search.results
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement