Class: NestedRecord::Setup
- Inherits:
-
Object
- Object
- NestedRecord::Setup
- Defined in:
- lib/nested_record/setup.rb
Defined Under Namespace
Instance Method Summary collapse
-
#initialize(owner, name, **options, &extension) ⇒ Setup
constructor
A new instance of Setup.
- #record_class ⇒ Object
Constructor Details
#initialize(owner, name, **options, &extension) ⇒ Setup
Returns a new instance of Setup.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/nested_record/setup.rb', line 4 def initialize(owner, name, **, &extension) = @owner = owner @record_class = [:class_name] || name.to_s.classify @name = name @extension = extension define_methods @owner.attribute @name, type, default: default_value @owner.validate validation_method_name end |
Instance Method Details
#record_class ⇒ Object
17 18 19 20 21 22 |
# File 'lib/nested_record/setup.rb', line 17 def record_class if @record_class.is_a? String @record_class = NestedRecord.lookup_const(@owner, @record_class) end @record_class end |