-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store reverse geo-coded address & force unique addresses #518
Conversation
|
||
puts "" | ||
|
||
Restroom.all.each do |restroom| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to do this for all Restrooms, or can we just do ones that have some columns missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends if you're particularly fussy about the display, for example casing and Street
vs St.
Merging into a refuge/ branch so I can fix the test |
By the way, when I looked at this, it made the I'm not fluent with Ruby enough to get why, although I can tell a lot is changed around in the same file that #513 touched, so it makes sense. (Not sure how important that is, probably not enough to block this new feature, but if I can help make it work again, would be happy to.) |
Context
Generally, this makes the data more consistent, however this relies more on the geocode lookup being correct for what the user puts in. It might be a good idea to force the user to preview (via google maps) before they can submit a restroom, or to use a proper address lookup. Thoughts?
Summary of Changes
Restrooms will now populate the geocode, then set the address fields to the address from a reverse lookup before validation.
The address field must be unique. This is only enforced in the activerecord model & not the database schema, meaning it won't complain about existing records / manually added records.
Added a task that iterates over each restroom and re-populates the address from a reverse geocode lookup (
db:reverse_geocode
/db:reverse_geocode[dry_run]
)