Inheriting class definition from parent class
问题 I am building Grape Entities inside my Rails models as described here: https://github.com/ruby-grape/grape-entity#entity-organization Currently I am creating default values automatically, based on the column hash of the model itself. So I have a static get_entity method that exposes all the model's columns: class ApplicationRecord < ActiveRecord::Base def self.get_entity(target) self.columns_hash.each do |name, column| target.expose name, documentation: { desc: "Col #{name} of #{self.to_s}" }