Drew Bragg


11,170 Experience
109 Lessons Completed
0 Questions Solved


Posted in Trix editor is not displaying properly in Rails 6

Try upgrading your @rails/webpacker package to the latest version, v5.2.1.

Did I miss a video? I've been following along (or at least I thought I was) but some of the layout is different and I don't remember the scrollTo stuff in the channel_controller

I'm curious as to why this is happening. The server is set up the exact same way as every other server I have yet this is the only one with this issue.

Real quick, you have your sendgrid PW in your config/envirnments/production.rb. You really should have that in your encyrpted credentails or a local ENV file otherwise it's going to (not might but going to) get stolen.

As far as the issue you're having, I cloned the repo and tried it out. It seems to work fine, an email is sent when a user registers. I even set up a local mail server to catch the emails being sent and was able to see them coming through.

I'm not sure what might be happening in Prod, I'm not that familiar with Heroku. But seems to work fine in Dev. Are you seeing the mail in your logs?

I'm hvaing an odd issue that I can't see to get a handle on.

When I ssh into my prod server and I try to open /home/deploy/app/shared/log/production.log in vim or nano the process just hangs for a while and then I get a message that just says killed. when I checkout the kernal log I see that OOM killed vim. I also can't pull down the log with rsync.

I can tail the log and see everyting just fine but I can't actually open the file...

Does anyone have a good idea of where to start looking into this?

Posted in Server Administration with Cockpit Discussion

This seems pretty cool! Unfortunetly following your instructions I'm unable to access port 9090, it just times out. I tried allowing it on ufw but still no luck. Not sure what I could have missed, the offical docs make it seems like install and go.

Posted in Caching Active Storage in the Browser

I'm running into this also. Did you ever find a solution?

Does anyone know if there's a way to send the preview request to a background job on upload? so something like sidekiq will handle generating and saving the preview when the file is uploaded and not waiting until a user requests the preview and making them wait?

I did something like this when using direct uploads.

I’m having a weird issue with acts-as-taggable-on when using tagged_with and the any flag.

My model looks something like this:

class Document < ApplicationRecord
  belongs_to :phase, optional: true

  scope :search_by_drug, ->(drug) { tagged_with(drug, on: :drug) if drug.present? }
  scope :search_by_area, ->(area) { tagged_with(area, on: :area) if area.present? }
  scope :search_by_type, ->(types) { tagged_with(types, on: :doc_type, any: true) if types.present? }
  scope :search_by_tags, ->(tags) { tagged_with(tags, on: :tags, any: true) if tags.present? }

  acts_as_taggable_on :tags, :drug, :area, :doc_type


and in my controller this is where I'm querying:

class DocumentsController < ApplicationController
  include Pagy::Backend

  # GET /documents
  def index
    @pagy, @documents = pagy(
      Document.includes(:phase, :taggings)
      items: 5



  def sort_by
    return @sort_by = 'phases.name' if params[:sort] == 'phase'

    @sort_by = params[:sort] || 'date'

  def order
    @order = params[:order] || 'asc'

  def sort_order
    "#{sort_by} #{order}"


When I'm seaching with taggs or by types and I try to order the phase column I’m thrown an error that looks like this:

ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
LINE 1: ...) AND "taggings"."context" = 'doc_type') ORDER BY phases.nam...

I’ve done a bunch of searching but the closest issues I could come up with was an old issue on the acts-as-taggable-on github but it was closed because (according to them) they had merged a PR that fixed the issue and there’s nothing new in their issues or SO.

Can anyone point me in the right direction?

gem install backup -v5.0.0.beta.1 will work with Ruby 2.4.x

Good question, following...
Great Video! I'm definitely interested in seeing how you handle a slide deck. 

Posted in Stimulus JS Framework Introduction Discussion

Awesome video Chris! started using Stimulus in a work project and it's a very nice way to keep the JS organized and reusable. Thanks!

Posted in RailsConf

Work is sending me to RailsConf in April, anyone else going to be there?