Class: Glib::ApplicationRecord
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Glib::ApplicationRecord
- Includes:
- EnumHumanization
- Defined in:
- app/models/glib/application_record.rb
Class Method Summary collapse
Methods included from EnumHumanization
Class Method Details
.glib_has_one_attached(field_name) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/models/glib/application_record.rb', line 13 def self.glib_has_one_attached(field_name) has_one_attached field_name define_method("#{field_name}=") do |value| if value == '' send(field_name).detach else super(value) end end end |