Created
December 4, 2015 06:05
-
-
Save yachi/6c8771cfff52d58fecec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Gemfile b/Gemfile | |
index 16ab922..62a5142 100644 | |
--- a/Gemfile | |
+++ b/Gemfile | |
@@ -114,6 +114,9 @@ source 'https://rubygems.org' do | |
# date range picker | |
gem 'bootstrap-daterangepicker-rails' | |
+ # full text search for postgresql | |
+ gem 'textacular' | |
+ | |
# localization | |
gem 'globalize' | |
gem 'globalize-accessors' | |
diff --git a/Gemfile.lock b/Gemfile.lock | |
index 901929d..93a1458 100644 | |
--- a/Gemfile.lock | |
+++ b/Gemfile.lock | |
@@ -979,6 +979,8 @@ GEM | |
term-ansicolor (1.3.2) | |
tins (~> 1.0) | |
terminal-table (1.5.2) | |
+ textacular (3.2.2) | |
+ activerecord (>= 3.0, < 5.0) | |
thor (0.19.1) | |
thread (0.2.2) | |
thread_safe (0.3.5) | |
@@ -1218,6 +1220,7 @@ DEPENDENCIES | |
spring-commands-sidekiq | |
swagger-blocks | |
syslogger (~> 1.6.0) | |
+ textacular | |
tunemygc | |
turbolinks | |
turnout | |
diff --git a/app/controllers/attendees_controller.rb b/app/controllers/attendees_controller.rb | |
index f5a316e..6c4c70b 100644 | |
--- a/app/controllers/attendees_controller.rb | |
+++ b/app/controllers/attendees_controller.rb | |
@@ -61,12 +61,12 @@ class AttendeesController < ApplicationController | |
attendee_ids = @attendees.select{ |attendee| attendee.pending_payments_humanized.downcase.include?(search_text_down) }.map &:id | |
@attendees = @attendees.where(id: attendee_ids) | |
else | |
- @attendees = @attendees.where("attendees.#{@search_field} ILIKE ?", "%#{@search_text}%") | |
+ @attendees = @attendees.basic_search(@search_field => @search_text) | |
end | |
end | |
# assign all approved/waitlist attendees to gon.attendees before do pagination | |
- gon.attendees = @attendees.ids | |
+ gon.attendees = @attendees.select(:id).collect(&:id) | |
if @sort_column == 'id' | |
@attendees = @attendees.order("attendees.id #{@sort_order}").page(@page).per(@per_page) | |
diff --git a/app/models/attendee.rb b/app/models/attendee.rb | |
index 9a1ed76..7feaa6d 100644 | |
--- a/app/models/attendee.rb | |
+++ b/app/models/attendee.rb | |
@@ -81,6 +81,10 @@ class Attendee < ActiveRecord::Base | |
store_accessor :custom_attendee_fields | |
+ def self.searchable_language | |
+ 'simple' | |
+ end | |
+ | |
def going? | |
group = self.rsvp_groups.first | |
group && group.kind.yes? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment