Permalink
Browse files

Top level actions:

* form multiple refactoring
  • Loading branch information...
1 parent 4236c4a commit a8adeaf57b336371096302a3cfc789d8a696e779 @elvanja committed Feb 24, 2014
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/deckhand/form.rb
View
@@ -41,12 +41,13 @@ def input(name, options = {})
def multiple(name, options = {}, &block)
@current_multiple_input = {inputs: {}, multiple: true, default: []}.merge(options)
- unless @current_group_input
+ block.call
+ if @current_group_input
+ @current_group_input[:inputs][name] = @current_multiple_input
+ else
attr_accessor name
self.inputs[name] = @current_multiple_input
end
- block.call
- @current_group_input[:inputs][name] = @current_multiple_input if @current_group_input
@current_multiple_input = nil
end

0 comments on commit a8adeaf

Please sign in to comment.