Skip to content
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

Good stuff. Just added some notes about Ruby conventions. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/controllers/donations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ def new
def create
@donation = @recipient.donations.build(donation_params)
@stripe_token = :stripe_token
# When evaluating booleans, you don't need `== true`. `if @donation.recurring`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Line is too long. [83/80]
Trailing whitespace detected.

# is all you need. Additionally, ruby's convention is to call the property
Copy link
Collaborator

Choose a reason for hiding this comment

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

Trailing whitespace detected.

# `is_recurring`, but that's probably a bigger refactor.
if @donation.recurring == true
if @donation.subscribe_stripe_customer && @donation.save
DonationMailer.monthly_donation_receipt(@donation).deliver_later
Expand Down Expand Up @@ -52,6 +55,7 @@ def edit
def update
@donation = @recipient.donations.find(params[:id])
if @donation.update(donation_params)
# The ruby convention is to use `unless` when evaluating a false boolean. So `unless @donation.recurring`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Line is too long. [112/80]

if @donation.recurring == false
@donation.delete_stripe_customer
DonationMailer.cancel_monthly_donation_confirmation(@donation).deliver_later
Expand Down