Skip to content

Commit

Permalink
Move before_update callback into GeocodingUtilities. [#43]
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed Oct 20, 2009
1 parent fc8356b commit 284e854
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion app/models/event.rb
Expand Up @@ -12,7 +12,6 @@ class Event < ActiveRecord::Base
validates_presence_of :name
validates_presence_of :state_id
before_create :set_created_by_id
before_update :clear_coords

default_scope :conditions => 'deleted is distinct from true'

Expand Down
1 change: 0 additions & 1 deletion app/models/user.rb
Expand Up @@ -23,7 +23,6 @@ class User < ActiveRecord::Base
validates_length_of :email, :within => 3..100
validates_uniqueness_of :email, :case_sensitive => false
before_save :make_single_access_token
before_update :clear_coords
after_create :set_calendar
# prevents a user from submitting a crafted form that bypasses activation
# anything else you want your user to change should be added here.
Expand Down
4 changes: 4 additions & 0 deletions lib/geocoding_utilities.rb
@@ -1,4 +1,8 @@
module GeocodingUtilities
def self.included(klass)
klass.before_update :clear_coords
end

# Sends the address contained in _string_ to a geocoder, and returns a #Point object with the resulting coordinates.
#
# _String_ is assumed to be in the format output by address_for_geocoding
Expand Down

0 comments on commit 284e854

Please sign in to comment.