aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/track_controller.rb5
-rw-r--r--config/routes.rb8
-rw-r--r--spec/controllers/track_controller_spec.rb2
3 files changed, 7 insertions, 8 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index 23d79b30c..2679cacc9 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -80,10 +80,7 @@ class TrackController < ApplicationController
# Track a search term
def track_search_query
- # XXX should be better thing in rails routes than having to do this
- # join just to get / and . to work in a query.
- query_array = params[:query_array]
- @query = query_array.join("/")
+ @query = params[:query_array]
# XXX more hackery to make alternate formats still work with query_array
if /^(.*)\.json$/.match(@query)
diff --git a/config/routes.rb b/config/routes.rb
index f629f9220..5c76cc96f 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -126,9 +126,11 @@ Alaveteli::Application.routes.draw do
match '/:feed/list/:view' => 'track#track_list', :as => :track_list, :view => nil, :feed => /(track|feed)/
match '/:feed/body/:url_name' => 'track#track_public_body', :as => :track_public_body, :feed => /(track|feed)/
match '/:feed/user/:url_name' => 'track#track_user', :as => :track_user, :feed => /(track|feed)/
- # XXX must be better way of getting dots and slashes in search queries to work than this *query_array
- # Also, the :format doesn't work. See hacky code in the controller that makes up for this.
- match '/:feed/search/*query_array' => 'track#track_search_query', :as => :track_search, :feed => /(track|feed)/
+ # XXX :format doesn't work. See hacky code in the controller that makes up for this.
+ match '/:feed/search/:query_array' => 'track#track_search_query',
+ :as => :track_search,
+ :feed => /(track|feed)/,
+ :constraints => { :query_array => /.*/ }
match '/track/update/:track_id' => 'track#update', :as => :update
match '/track/delete_all_type' => 'track#delete_all_type', :as => :delete_all_type
diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb
index 63192c99e..8d9d7637b 100644
--- a/spec/controllers/track_controller_spec.rb
+++ b/spec/controllers/track_controller_spec.rb
@@ -49,7 +49,7 @@ describe TrackController, "when making a new track on a request" do
it "should save a search track and redirect to the right place" do
session[:user_id] = @user.id
@track_thing.should_receive(:save!)
- get :track_search_query, :query_array => ["bob variety:sent"], :feed => 'track'
+ get :track_search_query, :query_array => "bob variety:sent", :feed => 'track'
response.should redirect_to(:controller => 'general', :action => 'search', :combined => ["bob", "requests"])
end