Skip to content

Commit

Permalink
Merge pull request #2309 from sparc-request/kg-protocol_search_bug
Browse files Browse the repository at this point in the history
KG - Fix Protocol Search Code When Search Term Blank
  • Loading branch information
Stuart-Johnson committed Apr 27, 2020
2 parents 6201f6f + d9f2202 commit 5990b90
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/protocol.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ def self.to_csv(protocols)
end
}

scope :search_query, lambda { |search_attrs|
scope :search_query, -> (search_attrs) {
return if search_attrs.search_text.blank?

# Searches protocols based on 'Authorized User', 'PI', 'Protocol ID', 'PRO#', 'RMID', 'Short/Long Title', OR 'Search All'
# Protects against SQL Injection with ActiveRecord::Base::sanitize
# inserts ! so that we can escape special characters
Expand Down

0 comments on commit 5990b90

Please sign in to comment.