Leon Entrup


1,550 Experience
14 Lessons Completed
0 Questions Solved


Posted in Metaprogramming Virtual Attributes Discussion

I have a model called Customer which belongs to a User. I am trying to implement a way for the Customer to have access to the attributes directly ( e.g.: Customer.first_name instead of having to write Customer.user.first_name ).
This is what I have so far:


after_initialize :set_user_properties,  if:  Proc.new { |c| c.user.present? }

def  set_user_properties
    # binding.pry
    c_columns =  Customer.columns.map { |c| { c.name.to_sym  => c.type } }
    u_columns =  User.columns.map { |c| { c.name.to_sym  => c.type } }.reject { |column| c_columns.include?(column) }.reduce  Hash.new,  :merge

    u_columns.each  do  |key, value|
        attribute key, value,  default:  self.user.try(key)

Posted in How do I insert smart variables with a text editor?

same :D

Posted in About Importmap rails gem

same :)

Posted in Caching with Etags Discussion

Hey Chris, thank you so much for making this tutorial :)

This post illustrates one the drawbacks of this solution that I could think of.
However, it was written in 2012. Is this still a vaild concern in rails 6/7?

I am aware of these guides:

My code for my ApplicationController can be found here

My after_sign_in_path_for(resource_or_scope) method returns nil when I put a debugger in it and I am trying to understand why that is the case:


=> nil


=> #<Userinstance>


=> "/"

Posted in error with purgecss and Tailwind 2

wow, thank you Chris for the quick reply. I am deeply grateful for the work you're doing. Always listen to the podcast too.

Posted in error with purgecss and Tailwind 2

Hey there, I am facing the following problem. In production, purgecss is preventing all all css from @tailwindcss/forms from being rendered properly. When I comment out purgecss everything is working just fine. The forms are located in the following file:


Here is my postcss.config.js :

let environment = {
  plugins: [
      autoprefixer: {
        flexbox: 'no-2009'
      stage: 3

if (process.env.RAILS_ENV === "production") {
      content: [
      defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || []

module.exports = environment

My package.json can be found here:


My tailwind.config.js can be found here:

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.