Peter vande Put


1,950 Experience
0 Lessons Completed
2 Questions Solved


Hi Chris,
Yet another good tutorial you made. I must say I always use option 1.
I don't like moving logic to JS if not needed because more dependencies and more code

Posted in Protecting source

I'm looking for a way to protect source code using a license server. Since ruby is not a compiled language looking for any experience with compiling ruby using rubyVM or other means.

Posted in Render before action completes

Julian looks nice one question I wanna show a spinner while building my variables which are about 20 which are rendered as graphs

How should I use your gem for this

Posted in How do I find a Rails mentor?

Hi Daniel,
I've 35+ years of software engineering experience and long time with rails.
The last 15 years where mainly architecting software.
Please contact me by private mail to [email protected] and we can discuss and schedule a call to discuss your expectations and how I might be able to help

Posted in Render before action completes

Controller action is taking a couple of seconds (complex calculations in dashboard) and i want to display a spinner on the html.erb file while waiting so basically start the rendering before the action completes. How can I do this?

Posted in Realtime browser updates with Cable Ready Discussion

I have an application using ActionCable broadcasting to about 100 TV screens when a new event happens.
This works great on local machine but on server (centOS, NGINX) I see a lot of Broken Pipe messages and many screens don't receive the updates.
Would this be a better solution or have the same problem since it's using the same technology under the hood? Please advice

Posted in Root route bypassing before_action

we have a posts_controller which takes a slug to render the correct page.
posts_controller inherits from application_controller which has a couple of before_actions

routes.rb has the following root

    root  'posts#show_post'

The before_actions are not called when going to localhost:3000 which renders the correct post.

also in the log i don't see the show_post action being called.
What am I missing here?

In our application we generate several reports. Instead of downloading them as Excel or CSV want to render them similar to Excel/Google sheet
anyone any ideas what the best approach is?

In our system we are sending webhook to an endpoint with serialized JSON for the object JobApplication.
The JobApplication has a resume attached using ActiveStorage. ( has_one_attached :resume)
How can I return a public URL to the resume in my JSON

class JobApplicationSerializer
  def self.exploded_json(object)
    json =object.to_json(:except => [:user_id,:created_at, :updated_at],
                         :include => [
                           :state => {:only => [:id, :name,:code]},
                           :country => {:only => [:id, :name,:code]}
    return json


Posted in splitting asset pipeline for front and backend

app has a consumer facing part and large backend/CMS part.
our assets (JS and SCSS) are precompiled into a very large file
in layouts we have a different layout for front- and backend

Is it possible to split assets:precompile into a front end and a backend part?

using asset_sync gem and fog

Posted in How can I force cloudfront assets to use http2?

in our app we have an image library which stores images in S3 linked to cloudfront.
cloudfront configured for http2
server is puma + nginx
problem is performance seems like all assets served from cloudfront/xxxxxx are using http1.1 instead of http2

how can this be solved?

Posted in How to have one application for multiple URL's

We have a requirement where are rails application should be available on multiple domains like and
based on domain it will only show a different logo all the rest is identical.
What's the best approach for this ? all tips are welcome

Posted in How can I display production s3 images in staging?

What I do is copy the production bucket to the staging bucket from time to time.
Have a simple Ruby script to do this.

Your model is wrong it's better to have a model named partner for example which has a partner type. Now you can seed it with partner types like Vendor, Customer, Supplier Both, whatever you want

class CreatePartnerTypes < ActiveRecord::Migration[5.2]
  def change
    create_table :partner_types do |t|
      t.string :name
    add_index :partner_types, :name,  unique: true

class CreatePartners < ActiveRecord::Migration[5.2]
  def change
    create_table :partners do |t|
      t.references :company
      t.references :partner_type
      t.string :name
      t.string :address
      t.string :postal_code
      t.string :city
      t.references :state

Posted in Is there an episode on Post Production Updates?

  1. Make sure to work from different branches in git (e.g. master branch is on your production server and develop is on your staging and local)
  2. Do not make changes to your to exisiting migrations, if you need to change/create models create a migration for it.
  3. In case you add a field to a modal and you are using it in a control flow make sure to set a default value
  4. New Controllers/Views can be added like normal
  5. After local testing deploy to your staging server * git pull * rails db:migrate * start your server
  6. If all is verified do the same on production from your master branch, restart your services

My system is using a post model with friendly_id so the calls are /name_of_the_post and this works great.
The initial home page is also a post so in routes.rb I have

    root 'home#index'
        get ':slug', to: 'posts#show_post', as: 'show_post'

    My HomeController has the following index action
        def index
        redirect_to '/home'
    The PostsController will pick up home slug and show the post, however my URL is now localhost:3000/home and I want it to be 

    How can I achieve this stripping the home slug (only for home)
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.