Class: SearchesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- SearchesController
- Defined in:
- app/controllers/searches_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/controllers/searches_controller.rb', line 14 def create :create, Search @search = Search.new(params[:search]) @search.organization_id = current_user.current_organization.id @search.save! redirect_to @search end |
#new ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/controllers/searches_controller.rb', line 6 def new :view, Search @search = Search.new(params[:search]) @membership_types = current_user.current_organization.membership_types.all @pass_types = current_user.current_organization.pass_types.all prepare_form end |
#show ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/searches_controller.rb', line 22 def show @search = Search.find(params[:id]) :view, @search @segment = Segment.new @membership_types = current_user.current_organization.membership_types.all @pass_types = current_user.current_organization.pass_types.all session[:return_to] ||= request.referer # Record the current page, in case creating a list segment fails. prepare_form prepare_people respond_to do |format| format.html { @people = @people.paginate(:page => params[:page], :per_page => (params[:per_page] || 20)) } format.csv { render :csv => Person.where(:id => @people.collect(&:id)).includes(:phones, :address, :tags).order('lower(people.last_name)'), :filename => "#{@search.id}-#{DateTime.now.strftime("%m-%d-%y")}" } end end |
#tag ⇒ Object
37 38 39 40 41 42 43 |
# File 'app/controllers/searches_controller.rb', line 37 def tag @search = Search.find(params[:id]) :tag, Segment @search.tag(params[:name]) flash[:notice] = "We're tagging all the people and we'll be done shortly. Refresh this page in a minute or two." redirect_to @search end |