1,920 Experience
15 Lessons Completed
0 Questions Solved


Posted in Dynamic Nested Forms with Turbo Discussion

Love everything about the screencast. The details, right speed and explanation. One thing i wished you would have explained is why the "task_field" action returns a turbo-stream automatically, without having to add code and tell it to respond_to turbo_stream. Seems a bit like magic

Posted in Please send invoices out attached by email

Hi Chris,

can you please consider sending invoices out by mail. It's a real hassle having to go in an collect them every month individually. Thanks!

Posted in API CRUD Actions Discussion

Great series. Are you gonna release it as a gem at the end?

I want to spawn a process (golang binary), capture its STDOUT and have a reference to STDIN which i can send to at any time. In my case i am getting data in via Websockets and want to pass them to STDIN of the spawned process.

I am having issues reusing STDIN with various methods i tried, like using PTY.spawn

input = nil

def run
  cmd = "app/bins/transcode" 
  read, write, pid = PTY.spawn(cmd)
  input = write
  Signal.trap(:WINCH) { write.winsize = STDOUT.winsize }

  read.each do |line|
    # THis works fine and sends the spawned process' STDOUT over websockets
    ActionCable.server.broadcast 'shell_channel', test: line

# This is never sent to STDIN of the spawned process
input.puts "hello"

I tried additionally to use a lock syntax with PTY and popen3 but both failed to receive STDIN.

Posted in Pitch: Replicate the Basecamp Jump Menu

Hi Chris,

i find the Basecamp Jump Menu to be a great feature and would love to see a video (or series) on a re-implementation with Stimulus https://3.basecamp-help.com/article/80-using-the-jump-menu


Posted in Docker Basics for Rails Discussion

Would this prevent gems from being re-installed every time you build the image, even when you did not make any changes to Gemfile?

Posted in Docker Basics for Rails Discussion

This is great, please more docker + rails tutorials. I would like to see how to not re-install all gems if you rebuild the image but have not changed the Gemfile at all.

Posted in How to model these relations in Rails

Thank you!

Posted in How to model these relations in Rails

Hi Chris,

is this something Rails has built in or would i need to set the fleet_type manually by checking if a Car or Train was created?

Posted in How to model these relations in Rails

For a couple of days now i am going back and forth how to models this.

I currently have the following model structure and relations (simplified)

class Fleet < ApplicationRecord
  # properties id, created_at, updated_at

  # A fleet should only consists of the same type, either a fleet or cars or a fleet of trains. Never both
    has_many :cars
    has_many :trains 

class Car < ApplicationRecord
  # properties id, created_at, updated_at, number_of_gears, is_sports_car 

  belongs_to :fleet

class Train < ApplicationRecord
  # properties id, created_at, updated_at, number_of_wagons, people_capacity, has_first_calass_section

  belongs_to :fleet

The problem i have is thata fleet should only consists of the same type, either a fleet of cars or a fleet of trains. Never both.

With the current relations on fleet, it seems error prone to have both has_many associations (or more coming like Airplanes) in terms of integrity and ease of use when calling @fleet._cars-or-trains, i would have to know what i can call.

STI is not an option since the properties are very different on a Car and a Train. There are many more properties, for the sake of simplicity i have shortened them in this example.

What is the right way in Rails to do this?

Do previewers for Word Files and Excel 

Bump :)

Do you loop through all the rooms also on the client side and call App.cable.subscriptions.create for each channel or is there a more straight forward way like subscribing to multiple channels at once?

Awesome :)

How do you subscribe on the client to multiple rooms ?

All examples i can find are subscribing to one single room by pasing a room as a param when creating the channel but what if i have Room A, B and C an i (as a user) am in all of them.

This is an example with one room http://edgeguides.rubyonrails.org/action_cable_overview.html#client-server-interactions-subscriptions

Posted in Screencast Request: Authorization with ActionCable

Yeah i will probably do that because i can get away with it. It's a internal chat but for public ones like Slack that wouldn't work well. Performance would be a problem when storing all of that in the DOM.

I checked out Slack and it does not have all of the chat rooms inside the DOM. There is no local storage too so my best guess is that it stores it inside a JS variable in memory and it fills a single chat room DOM node when you click the rooms.

Posted in Screencast Request: Authorization with ActionCable

Yep definitely.

What approach would you take on the client side? When you have 5 chat rooms but you are only viewing one at a time, where would you store the messages of the other 4 so when you select another channel to view, you don't have to query the db every time.

anime.season.update(title: "Spring 2015")

A cast about how to do authorization with ActionCable. Example is a Chat with multiple chat rooms and messages should only be sent to rooms / people who have access to the given chat room.

logo Created with Sketch.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2022 GoRails, LLC. All rights reserved.