Skip to content

Commit

Permalink
Fix searches for the non-beta version of Mongoid
Browse files Browse the repository at this point in the history
  • Loading branch information
justinweiss committed Dec 20, 2011
1 parent f0d374d commit 702182d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/error_stalker/server/views/_exception_table.erb
@@ -1,4 +1,4 @@
<%= will_paginate @rows, :params => params %>
<%= will_paginate @rows %>
<table id="exceptions" cellpadding="0">
<tr>
<th class="count">&nbsp;</th>
Expand Down
6 changes: 3 additions & 3 deletions lib/error_stalker/server/views/search.erb
Expand Up @@ -26,10 +26,10 @@
<input id="type" type="text" name="type" value="<%= params[:type] %>" />

<% if store.supports_extended_searches? %>
<label for="data">Extra data (key:"value")</label>
<input id="data" type="text" name="data" value="<%= params[:data] %>" />
<label for="data">Extra data</label>
<input id="data" type="text" name="data" value="<%= params[:data] %>" placeholder="REMOTE_ADDR:127.0.0.1 PATH:/test" />
<% end %>

<input type="submit" name="Search" value="Search" />
</form>
</div>
Expand Down
7 changes: 4 additions & 3 deletions lib/error_stalker/store/mongoid.rb
Expand Up @@ -100,20 +100,21 @@ def search(params)

[:application, :machine].each do |param|
if params[param] && !params[param].empty?
scope.where(param => params[param])
puts "HERE: #{params.inspect}"
scope = scope.where(param => params[param])
end
end

[:exception, :type].each do |param|
if params[param] && !params[param].empty?
scope.where(param => /#{params[param]}/)
scope = scope.where(param => /#{params[param]}/)
end
end

if params[:data] && !params[:data].empty?
params[:data].split.each do |keyvalue|
key, value = keyvalue.split(':')
scope.where("data" => {"#{key}" => "#{value}"})
scope = scope.where("data" => {"#{key}" => "#{value}"})
end
end

Expand Down

0 comments on commit 702182d

Please sign in to comment.