Skip to content

Commit

Permalink
Be humane and treat /rules and /rules/ equally - show all rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioj-x30d committed Sep 4, 2012
1 parent 3783c2e commit 4bcc48b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rules.rb
Expand Up @@ -120,12 +120,12 @@ def rules_as_json_string(param)
# TODO: return 404 if rule not found
rulespecs = []

if not param.nil? and param =~ /^-?[0-9]*$/ then
if not param.nil? and param =~ /^-?[1-9][0-9]*$/ then
num = param.to_i
if @rules.has_key?(num) then
rulespecs << @rules[num].rulespec
end
elsif param.nil? or param.downcase == 'all' then
elsif param.nil? or param == '' or param.downcase == 'all' then
@rules_lock.synchronized do
@rule_numbers.each do |rln|
rulespecs << @rules[rln].rulespec
Expand Down

0 comments on commit 4bcc48b

Please sign in to comment.