Skip to content

Commit

Permalink
Merge pull request #160 from wecasa/arel-for-not-null-condition
Browse files Browse the repository at this point in the history
Use Arel for `IS NOT NULL` SQL condition
  • Loading branch information
ryankopf committed Jan 24, 2023
2 parents f1c196b + 2389840 commit 178863b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/geokit-rails/acts_as_mappable/class_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def by_distance(options = {})
end

def with_latlng
where("?.? IS NOT NULL AND ?.? IS NOT NULL", table_name, lat_column_name, table_name, lng_column_name)
where(arel_table[lat_column_name].not_eq(nil).and(arel_table[lng_column_name].not_eq(nil)))
end

def closest(options = {})
Expand Down

0 comments on commit 178863b

Please sign in to comment.