weteamsteve / squadsnap2

The #2 sports team management app that makes communication and organization a breeze. Clubs and leagues love us too. Try it now.
1 stars 0 forks source link

Implement ActiveMailer #4

Open weteamsteve opened 5 years ago

weteamsteve commented 5 years ago

Reference issue 10 from squadsnap

Use ActionMailer to implement feature that emails squad owner when requesting membership to squad.

weteamsteve commented 5 years ago

Other comments:

It is in the create method of your controller where you will also instantiate a corresponding mailer object.

Create it in the members controller.

Pass in member object so we know the user and the squad. SO SICK OMG

Reference new Models page on Squadsnap/Wiki

{:member=>#<Member id: 2, user_id: 2, position: nil, number: nil, membership: "member", created_at: "2019-06-02 05:17:44", updated_at: "2019-06-02 05:18:05", squad_id: 1>}

Two hours and done! Biggest problem was understanding that member parameter was passed in as a hash, and had to access member in that hash then the object members.

Note: using app specific password for security on Google.