Class: SearchesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- SearchesController
- Defined in:
- app/controllers/searches_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 |
# File 'app/controllers/searches_controller.rb', line 12 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 |
# File 'app/controllers/searches_controller.rb', line 6 def new :view, Search @search = Search.new(params[:search]) prepare_search_and_people end |
#show ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/searches_controller.rb', line 20 def show @search = Search.find(params[:id]) :view, @search @segment = Segment.new session[:return_to] ||= request.referer # Record the current page, in case creating a list segment fails. prepare_search_and_people respond_to do |format| format.html format.csv { render :csv => @search.people, :filename => "#{@search.id}-#{DateTime.now.strftime("%m-%d-%y")}" } end end |
#tag ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/controllers/searches_controller.rb', line 32 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 |