Red Hendery


1,100 Experience
3 Lessons Completed
1 Question Solved


Is there a reason why we add the key to production.rb as opposed to application.rb like the docs say?

Posted in Sendgrid / Mailer Issue

Issue was being caused by a Click Tracking setting in SendGrid, URL's display correctly now but do not activate account in production. Heroku log below:

2021-04-04T17:28:35.393591+00:00 heroku[router]: at=info method=GET path="/" request_id=acdf2f79-632b-4732-9af4-a9578fe7b512 fwd="" dyno=web.1 connect=0ms service=11ms status=200 bytes=5322 protocol=https
2021-04-04T17:28:35.383993+00:00 app[web.1]: I, [2021-04-04T10:28:35.383892 #4]  INFO -- : [acdf2f79-632b-4732-9af4-a9578fe7b512] Started GET "/" for at 2021-04-04 10:28:35 -0700
2021-04-04T17:28:35.385055+00:00 app[web.1]: I, [2021-04-04T10:28:35.384970 #4]  INFO -- : [acdf2f79-632b-4732-9af4-a9578fe7b512] Processing by StaticPagesController#home as HTML
2021-04-04T17:28:35.386143+00:00 app[web.1]: D, [2021-04-04T10:28:35.386060 #4] DEBUG -- : [acdf2f79-632b-4732-9af4-a9578fe7b512]   Rendering layout layouts/application.html.erb
2021-04-04T17:28:35.386244+00:00 app[web.1]: D, [2021-04-04T10:28:35.386178 #4] DEBUG -- : [acdf2f79-632b-4732-9af4-a9578fe7b512]   Rendering static_pages/home.html.erb within layouts/application
2021-04-04T17:28:35.386830+00:00 app[web.1]: I, [2021-04-04T10:28:35.386749 #4]  INFO -- : [acdf2f79-632b-4732-9af4-a9578fe7b512]   Rendered static_pages/home.html.erb within layouts/application (Duration: 0.5ms | Allocations: 99)
2021-04-04T17:28:35.387808+00:00 app[web.1]: D, [2021-04-04T10:28:35.387718 #4] DEBUG -- : [acdf2f79-632b-4732-9af4-a9578fe7b512]   Rendered layouts/partials/_rails_default.html.erb (Duration: 0.7ms | Allocations: 220)
2021-04-04T17:28:35.389017+00:00 app[web.1]: D, [2021-04-04T10:28:35.388933 #4] DEBUG -- : [acdf2f79-632b-4732-9af4-a9578fe7b512]   Rendered layouts/partials/_navbar.html.erb (Duration: 1.0ms | Allocations: 273)
2021-04-04T17:28:35.389398+00:00 app[web.1]: D, [2021-04-04T10:28:35.389316 #4] DEBUG -- : [acdf2f79-632b-4732-9af4-a9578fe7b512]   Rendered layouts/partials/_footer.html.erb (Duration: 0.1ms | Allocations: 19)
2021-04-04T17:28:35.389527+00:00 app[web.1]: I, [2021-04-04T10:28:35.389440 #4]  INFO -- : [acdf2f79-632b-4732-9af4-a9578fe7b512]   Rendered layout layouts/application.html.erb (Duration: 3.3ms | Allocations: 819)
2021-04-04T17:28:35.389905+00:00 app[web.1]: I, [2021-04-04T10:28:35.389815 #4]  INFO -- : [acdf2f79-632b-4732-9af4-a9578fe7b512] Completed 200 OK in 5ms (Views: 3.9ms | ActiveRecord: 0.0ms | Allocations: 1223)
2021-04-04T17:28:35.529104+00:00 heroku[router]: at=info method=GET path="/packs/css/application-1ede7797.css" request_id=f7590cd2-5713-4d53-a226-51c9565508df fwd="" dyno=web.1 connect=0ms service=3ms status=304 bytes=112 protocol=https

Posted in Sendgrid / Mailer Issue


I run a website and I am having issues generating mailer links correctly, when a User signs up they must verify their email address. This all works as expected, mailer sends the email and it gets received.

The site is hosted on Heroku, when I view the logs they contain the route as I would expect, but in the email the link starts which is tied to the Sender Authentication I was required to do.

Unsure what code is going to be helpful but happy to post anything requested.


  config.action_mailer.perform_caching = false
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.default_url_options = { protocol: 'https', host: '' }

  ActionMailer::Base.smtp_settings = {
    :address        => '',
    :port           => '587',
    :authentication => :plain,
    :user_name      => 'apikey',
    :password       => ENV['SENDGRID_API_KEY'],
    :domain         => '',
    :enable_starttls_auto => true

I am open to using a Sendgrid alternative, just needs to be cheap as we are going to send maybe 1000 emails a year.

Posted in How to create new contacts from nested attributes form

Is that the nested_attributes bit? Without seeing your code it's hard to say for sure, but you quite probably don't need to use nested_attributes, they'll just be adding unnecessary complexity.

I'm happy to look at your repo if you add redhendery to it on Github.

Posted in How to create new contacts from nested attributes form

Hey Seth,

You most likely don't need to use inverse_of, a correctly setup has_many_though association will give you access to things like Contact.signins or OpenHouses.contacts etc... Try:

Signin Model:
belongs_to :contact
belongs_to :open_house

Contact Model:
has_many :signins
has_many :open_houses, through: signins

OpenHouse Model:
has_many :signins
has_many :contacts, through: signins

Then check your signin migration, and makes sure you have:
t.belongs_to :contact, index: true
t.belongs_to :open_house, index: true

Let me know if you need any more help.

You probably just need to add contact_id: [] to the signin_params.

Need to check your migrations as well and make sure you have your associations set correctly.

Suggest reading the Rails Guides on has_many_through

You should also rename signin to viewings or something else. I would say the vast majority of people reading your code would think that the signin controller is for users signing in and not for what it actually does.

Sorry for the formatting of my post, I’m on a mobile device.

Posted in Is there a beginners course?

The Odin Project is a great place to start and if you're willing to pay for it, Michael Hartl's Rails tutorial is also excellent.

There are also loads of free lessons on Go Rails to get you started.