]> source.dussan.org Git - redmine.git/commitdiff
Prevents NoMethodError on @available_filters.has_key? in query.rb (#1178).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 25 May 2008 12:50:33 +0000 (12:50 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 25 May 2008 12:50:33 +0000 (12:50 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1454 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/query.rb
test/unit/query_test.rb

index f25b5c401d3204e4e21bba669d7c128409e033be..c19bb8d7e29f7a4f4d3def5dcfc8037a7e8780a7 100644 (file)
@@ -227,7 +227,7 @@ class Query < ActiveRecord::Base
   end
   
   def label_for(field)
-    label = @available_filters[field][:name] if @available_filters.has_key?(field)
+    label = available_filters[field][:name] if available_filters.has_key?(field)
     label ||= field.gsub(/\_id$/, "")
   end
 
index e143e6fc2a893489b98282068fd5e2c70e996151..147bfbea35ae63bc7bfeeba34219bb8ea8b2dd9f 100644 (file)
@@ -116,6 +116,11 @@ class QueryTest < Test::Unit::TestCase
     assert q.has_column?(c)
   end
   
+  def test_label_for
+    q = Query.new
+    assert_equal 'assigned_to', q.label_for('assigned_to_id')
+  end
+  
   def test_editable_by
     admin = User.find(1)
     manager = User.find(2)