Maximilian Kirsch

Joined

200 Experience
1 Lesson Completed
0 Questions Solved

Activity

Posted in Deploy Action Cable & Redis to production

I'm currently integrating Stimulus Reflex and Cable Ready in my application and want to deploy it to my production server. The guide here on how to deploy ActionCable to production seems very outdated, so some questions:

I found different tuturials on this topic, but most of them for Rails 4/5.
Regarding the cable.yml configuration file: If I install redis on my webserver, does the production url have to point to localhost or to my domain (url: redis://localhost:6379/1 or url: redis://redis.mydomain.com:6379/1)?

Posted in Ruby on Rails ActionMailer Images Issue

I'm trying to use embedded images in my E-Mail, but if I try to load a file from my image folder as a header, it's not displaying in the email:

The image is an inline attachment:

def export_bill_email(user)
        @user = user
        attachments.inline["logo.jpg"] = File.read("#{Rails.root}/app/assets/images/bdh_caption_logo.jpg")
        make_bootstrap_mail(
            to: 'xxx',
            from: 'xxx',
            subject: 'xxx'
        )
    end

(Don't mind the make_bootstrap_mailmethod here, I'm using the bootstrap email gem - I also tried it with the standard mail method - doesn't work either :/.

Then in my view, I try to call it the following way:

<%= image_tag(attachments["logo.jpg"].url, width: '100', height: '100') %>

Is it not displaying cause of development mode? I also tried forwarding with ngrok, but still, it's just displaying a broken image sign in my received email.
The strange thing is: If I use a direct hyperlink to an image, it is displayed so it has to do something with the image URL I guess, but I can't figure it out.

I could use the asset host method in my environment file, but this way I had to host the images like forever so they get displayed correctly in the mails, so I would rather like to go with an attachment.

Thanks for any good advice!

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.