lib/controllers/collections.rb in mongo3-0.0.7 vs lib/controllers/collections.rb in mongo3-0.0.8

- old
+ new

@@ -57,11 +57,13 @@ # --------------------------------------------------------------------------- post "/collections/search/" do json = params[:search].gsub( /'/, "\"" ) if json.empty? @query = {} - @sort = {} + @sort = [] + session[:query_params] = [@query,@sort] + load_cltn else tokens = json.split( "|" ) begin @query = JSON.parse( tokens.shift ) @sort = tokens.empty? ? [] : JSON.parse( tokens.first ) @@ -104,10 +106,10 @@ end # =========================================================================== helpers do def load_cltn( page=1 ) - query_params = session[:query_params] || [{},[]] + query_params = session[:query_params] || [Hash.new,[]] if ( !query_params.first or query_params.first.empty?) and ( !query_params.last or query_params.last.empty? ) @query = nil else @query = [query_params.first.to_json, query_params.last.to_json].join( " | " ) @query.gsub!( /\"/, "'" ) \ No newline at end of file