Created
July 17, 2020 14:29
-
-
Save LucasKuhn/158fa37aecbc725ed33c9b4d6fd34481 to your computer and use it in GitHub Desktop.
What form_with does
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# helpers/form_helper.rb | |
def form_with(model: nil, scope: nil, url: nil) | |
# ... | |
url = polymorphic_path(model) | |
html_options = html_options_for_form_with(url, model, **options) | |
form_tag_html(html_options) | |
end | |
# helpers/form_tag_helper.rb | |
def form_tag_html(html_options) | |
# ... | |
tag(:form, html_options, true) | |
end | |
# helpers/tag_helper.rb | |
def tag(name = nil, options = nil) | |
# ... | |
"<#{name}#{tag_builder.tag_options(options, escape) if options}#{open ? ">" : " />"}".html_safe | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment