Sha256: 09ff80e96431aec9442544ccb9c76203a56bfebc0d9984c143412fe19498e245

Contents?: true

Size: 491 Bytes

Versions: 5

Compression:

Stored size: 491 Bytes

Contents

# frozen_string_literal: true

class Vegetable < ActiveRecord::Base
  validates_presence_of :name

  def self.inheritance_column
    "custom_type"
  end
end

class Cucumber < Vegetable
end

class Cabbage < Vegetable
end

class GreenCabbage < Cabbage
end

class KingCole < GreenCabbage
end

class RedCabbage < Cabbage
  belongs_to :seller, class_name: "Company"
end

class YellingVegetable < Vegetable
  after_initialize :format_name

  def format_name
    self.name = name&.upcase
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ibm_db-5.5.0 test/models/vegetables.rb
ibm_db-5.4.1 test/models/vegetables.rb
ibm_db-5.4.0 test/models/vegetables.rb
ibm_db-5.3.2 test/models/vegetables.rb
ibm_db-5.3.1 test/models/vegetables.rb