Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Feature/105 save users state - #108

Merged
rickr merged 6 commits into
masterfrom
feature/105-save-users-state
Jul 21, 2017
Merged

rickr merged 6 commits into
masterfrom
feature/105-save-users-state

Conversation

@hpjaj

@hpjaj hpjaj commented Jul 21, 2017

Copy link
Copy Markdown
Collaborator

Description of changes

Saves the state the User lives in, to their db record. Specifically:

  • Adds a new attribute to the User model called :state
  • Extends the before_save filter to save the user's :state abbreviation into the new attribute
  • Rake task to populate all existing users :state, if their latitude and longitude exists
  • Rake task accounts for Google geocoding API rate limits

Issue Resolved

Fixes #105

Comment thread app/models/user.rb
:recoverable, :rememberable, :trackable, :validatable
geocoded_by :zip

geocoded_by :zip do |user, results|

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rickr - Not terribly pleased that this is a block being passed, at the top of the user.rb file, versus a method being called. However, was not able to find an alternative solution in the Geocoder docs.

Let me know if you know of one/want it changed.

@rickr rickr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

@rickr
rickr merged commit a9a2792 into master Jul 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants