Class: Reform::Form::Populator::IfEmpty
- Inherits:
-
Reform::Form::Populator
- Object
- Reform::Form::Populator
- Reform::Form::Populator::IfEmpty
- Defined in:
- lib/reform/form/populator.rb
Overview
Populator
Instance Method Summary collapse
-
#call!(form, fragment, twin, *args) ⇒ Object
FIXME: the optional index parameter SUCKS.
Methods inherited from Reform::Form::Populator
Constructor Details
This class inherits a constructor from Reform::Form::Populator
Instance Method Details
#call!(form, fragment, twin, *args) ⇒ Object
FIXME: the optional index parameter SUCKS.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/reform/form/populator.rb', line 46 def call!(form, fragment, twin, *args) = args.last if .binding.array? # FIXME: ifs suck. index = args.first item = twin.original[index] and return item twin.insert(index, run!(form, fragment, )) # form.songs.insert(Song.new) else return if twin form.send(.binding.setter, run!(form, fragment, )) # form.artist=(Artist.new) end end |