-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backend search constraints (length & whitespace) (#630)
* refactor search * delete commented lines * resolve code climate * add flash notice * use request.referrer to reference last page * fix rubocop * refactorings * fix rubocop * more refactorings * fix more rubocop * squeeze center whitespace * strip leading and trailing whitespace * refactor map.rb to fix rubocop class over 250 lines * fix offences * fix cops * offence fix * fix last robocop * fix cop * cop * fix redundant self * remove redunant self pt2 * undo new asset path * tag fix
- Loading branch information
1 parent
275c2a3
commit 6c79669
Showing
5 changed files
with
121 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'open3' | ||
|
||
# custom validator used in map.rb | ||
class NotAtOriginValidator < ActiveModel::Validator | ||
def validate(rec) | ||
rec.errors[:base] << '0,0 is an unlikely locale.' if null_island?(rec) | ||
end | ||
|
||
def null_island?(rec) | ||
rec.lat.zero? || rec.lon.zero? | ||
end | ||
end |