Commit 6142de6002b4b10641dbc73478c151018f05ca02
1 parent
1a927cde
Exists in
scope2method
Replace scope by class method to avoid conflict
It was raising the error "You tried to define a scope named "like_search" on the model "SoftwareInfo", but Active Record already defined a class method with the same name." On Rails 4.1 "scope" raises on "dangerous" name conflicts: https://github.com/rails/rails/commit/7e8e91c439c1a877f867cd7ba634f7297ccef04b
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
src/noosfero-spb/software_communities/lib/software_info.rb
... | ... | @@ -91,12 +91,12 @@ class SoftwareInfo < ActiveRecord::Base |
91 | 91 | settings_items :another_license_version, :another_license_link |
92 | 92 | |
93 | 93 | # used on find_by_contents |
94 | - scope :like_search, lambda{ |name| | |
94 | + def self.like_search name | |
95 | 95 | joins(:community).where( |
96 | 96 | "name ILIKE ? OR acronym ILIKE ? OR finality ILIKE ?", |
97 | 97 | "%#{name}%", "%#{name}%", "%#{name}%" |
98 | 98 | ) |
99 | - } | |
99 | + end | |
100 | 100 | |
101 | 101 | scope :search, lambda { |name="", database_description_id = "", |
102 | 102 | programming_language_id = "", operating_system_name_id = "", | ... | ... |