2017-07-09 13:41:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2012-09-02 11:19:50 -04:00
|
|
|
class Vegetable < ActiveRecord::Base
|
|
|
|
validates_presence_of :name
|
|
|
|
|
|
|
|
def self.inheritance_column
|
2016-08-06 12:26:20 -04:00
|
|
|
"custom_type"
|
2012-09-02 11:19:50 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Cucumber < Vegetable
|
|
|
|
end
|
|
|
|
|
|
|
|
class Cabbage < Vegetable
|
|
|
|
end
|
2012-09-03 14:30:43 -04:00
|
|
|
|
|
|
|
class GreenCabbage < Cabbage
|
|
|
|
end
|
|
|
|
|
|
|
|
class KingCole < GreenCabbage
|
|
|
|
end
|
|
|
|
|
|
|
|
class RedCabbage < Cabbage
|
2016-08-06 13:37:57 -04:00
|
|
|
belongs_to :seller, class_name: "Company"
|
2012-09-03 14:30:43 -04:00
|
|
|
end
|
2020-09-20 12:24:19 -04:00
|
|
|
|
|
|
|
class YellingVegetable < Vegetable
|
|
|
|
after_initialize :format_name
|
|
|
|
|
|
|
|
def format_name
|
|
|
|
self.name = name&.upcase
|
|
|
|
end
|
|
|
|
end
|