Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
87 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
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 |
---|---|---|
@@ -1,14 +1,9 @@ | ||
class ThingMailer < ActionMailer::Base | ||
default from: "adoptahydrant@cityofboston.gov" | ||
default from: 'adoptahydrant@cityofboston.gov' | ||
|
||
def reminder(thing) | ||
@thing = thing | ||
@user = thing.user | ||
mail( | ||
{ | ||
to: thing.user.email, | ||
subject: ["Remember to shovel", thing.name].compact.join(' '), | ||
} | ||
) | ||
mail(to: thing.user.email, subject: ['Remember to shovel', thing.name].compact.join(' ')) | ||
end | ||
end |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
class Reminder < ActiveRecord::Base | ||
include ActiveModel::ForbiddenAttributesProtection | ||
validates_presence_of :from_user, :to_user, :thing | ||
belongs_to :from_user, class_name: "User" | ||
belongs_to :to_user, class_name: "User" | ||
belongs_to :from_user, class_name: 'User' | ||
belongs_to :thing | ||
belongs_to :to_user, class_name: 'User' | ||
validates :from_user, presence: true | ||
validates :thing, presence: true | ||
validates :to_user, presence: true | ||
end |
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 |
---|---|---|
@@ -1,21 +1,19 @@ | ||
class User < ActiveRecord::Base | ||
include ActiveModel::ForbiddenAttributesProtection | ||
# Include default devise modules. Others available are: | ||
# :token_authenticatable, :confirmable, | ||
# :lockable, :timeoutable and :omniauthable | ||
devise :database_authenticatable, :registerable, :recoverable, :rememberable, | ||
:trackable, :validatable | ||
:trackable, :validatable | ||
before_validation :remove_non_digits_from_phone_numbers | ||
has_many :reminders_from, class_name: 'Reminder', foreign_key: 'from_user_id' | ||
has_many :reminders_to, class_name: 'Reminder', foreign_key: 'to_user_id' | ||
has_many :things | ||
validates :name, presence: true | ||
validates_formatting_of :email, using: :email | ||
validates_formatting_of :sms_number, using: :us_phone, allow_blank: true | ||
validates_formatting_of :voice_number, using: :us_phone, allow_blank: true | ||
validates_formatting_of :zip, using: :us_zip, allow_blank: true | ||
validates_presence_of :name | ||
has_many :reminders_to, class_name: "Reminder", foreign_key: "to_user_id" | ||
has_many :reminders_from, class_name: "Reminder", foreign_key: "from_user_id" | ||
has_many :things | ||
before_validation :remove_non_digits_from_phone_numbers | ||
|
||
def remove_non_digits_from_phone_numbers | ||
self.sms_number = self.sms_number.to_s.gsub(/\D/, '').to_i if self.sms_number.present? | ||
self.voice_number = self.voice_number.to_s.gsub(/\D/, '').to_i if self.voice_number.present? | ||
self.sms_number = sms_number.to_s.gsub(/\D/, '').to_i if sms_number.present? | ||
self.voice_number = voice_number.to_s.gsub(/\D/, '').to_i if voice_number.present? | ||
end | ||
end |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Set up gems listed in the Gemfile. | ||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) | ||
|
||
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) | ||
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
RailsAdmin.config do |config| | ||
config.authenticate_with do | ||
redirect_to(main_app.root_path, flash: {warning: "You must be signed-in as an administrator to access that page"}) unless signed_in? && current_user.admin? | ||
redirect_to(main_app.root_path, flash: {warning: 'You must be signed-in as an administrator to access that page'}) unless signed_in? && current_user.admin? | ||
end | ||
end |
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
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
Oops, something went wrong.