Module: CrudComponents::Model::ClassMethods
- Defined in:
- lib/crud_components/model.rb
Instance Method Summary collapse
- #crud_structure(&block) ⇒ Object
-
#reset_crud_structure! ⇒ Object
For tests and code reloading.
Instance Method Details
#crud_structure(&block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/crud_components/model.rb', line 10 def crud_structure(&block) raise ArgumentError, 'crud_structure requires a block' unless block if instance_variable_defined?(:@_crud_structure_block) && @_crud_structure_block raise DefinitionError, "crud_structure already declared on #{self} — merge the two blocks " \ '(the second one would otherwise silently win)' end @_crud_structure_block = block @_crud_structure = nil end |
#reset_crud_structure! ⇒ Object
For tests and code reloading.
27 28 29 30 |
# File 'lib/crud_components/model.rb', line 27 def reset_crud_structure! @_crud_structure_block = nil @_crud_structure = nil end |