Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Client < ActiveRecord::Base
- belongs_to :user
- has_many :call_center_touches
- has_many :support_touches
- has_many :sales_touches
- has_many :client_events
- has_many :events, through: :client_events
- def self.text_search(query)
- self.where("similarity(name, ?) > 0.2 OR similarity(iin, ?) > 0.2 OR similarity(email, ?) > 0.2 OR similarity(phone, ?) > 0.2" , query, query, query, query).order("similarity(name, #{ActiveRecord::Base.connection.quote(query)}) DESC")
- end
- end
Add Comment
Please, Sign In to add comment