Defect #27122 » case_sensitive_filter_for_version_name_4.patch
app/models/version.rb | ||
---|---|---|
134 | 134 |
scope :like, lambda {|arg| |
135 | 135 |
if arg.present? |
136 | 136 |
pattern = "%#{arg.to_s.strip}%" |
137 |
where("LOWER(#{Version.table_name}.name) LIKE :p", :p => pattern)
|
|
137 |
where([Redmine::Database.like("#{Version.table_name}.name", '?'), pattern])
|
|
138 | 138 |
end |
139 | 139 |
} |
140 | 140 |
scope :open, lambda { where(:status => 'open') } |
test/unit/version_test.rb | ||
---|---|---|
277 | 277 |
assert_equal false, version.deletable? |
278 | 278 |
end |
279 | 279 | |
280 |
def test_like_scope |
|
281 |
version = Version.create!(:project => Project.find(1), :name => 'Version for like scope test') |
|
282 | ||
283 |
assert_includes Version.like('VERSION FOR LIKE SCOPE TEST'), version |
|
284 |
assert_includes Version.like('version for like scope test'), version |
|
285 |
assert_includes Version.like('like scope'), version |
|
286 |
end |
|
287 | ||
280 | 288 |
private |
281 | 289 | |
282 | 290 |
def add_issue(version, attributes={}) |
- « Previous
- 1
- 2
- 3
- 4
- Next »