lib/hanami/helpers/form_helper.rb in hanami-helpers-1.1.1 vs lib/hanami/helpers/form_helper.rb in hanami-helpers-1.1.2

- old
+ new

@@ -227,11 +227,11 @@ # @param url [String] the form action URL # @param options [Hash] HTML attributes to pass to the form tag and form values # @option options [Hash] :values An optional payload of objects to pass # @param blk [Proc] A block that describes the contents of the form # - # @overload form_for(form, attributes, &blk) + # @overload form_for(form, attributes = {}, &blk) # Use Form # @param form [Hanami::Helpers::FormHelper::Form] a form object # @param attributes [Hash] HTML attributes to pass to the form tag and form values # @param blk [Proc] A block that describes the contents of the form # @@ -404,12 +404,12 @@ # <input type="text" name="delivery[customer_name]" id="delivery-customer-name" value=""> # <input type="text" name="delivery[address][city]" id="delivery-address-city" value=""> # # <button type="submit">Create</button> # </form> - def form_for(name, url, options = {}, &blk) + def form_for(name, url = nil, options = {}, &blk) form = if name.is_a?(Form) - options = url + options = url || {} name else Form.new(name, url, options.delete(:values)) end