Prevents NoMethodError on @available_filters.has_key? in query.rb (#1178).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1454 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
02757f5892
commit
03f0236a6e
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue