Rails Form Tag

[Solved] Rails Form Tag | Ruby - Code Explorer | yomemimo.com
Question : rails form_tag

Answered by : puzzled-peacock-nlwdehk8n1mi

form_tag('/posts')
# => <form action="/posts" method="post">
form_tag('/posts/1', method: :put)
# => <form action="/posts/1" method="post"> ... <input name="_method" type="hidden" value="put" /> ...
form_tag('/upload', multipart: true)
# => <form action="/upload" method="post" enctype="multipart/form-data">
<%= form_tag('/posts') do -%> <div><%= submit_tag 'Save' %></div>
<% end -%>
# => <form action="/posts" method="post"><div><input type="submit" name="commit" value="Save" /></div></form>
<%= form_tag('/posts', remote: true) %>
# => <form action="/posts" method="post" data-remote="true">
form_tag('http://far.away.com/form', authenticity_token: false)
# form without authenticity token
form_tag('http://far.away.com/form', authenticity_token: "cf50faa3fe97702ca1ae")
# form with custom authenticity token

Source : https://apidock.com/rails/ActionView/Helpers/FormTagHelper/form_tag | Last Update : Tue, 02 Jun 20

Question : form feild rails helper

Answered by : doubtful-dingo

<%= form_tag("/search", method: "get") do %>
  <%= label_tag(:q, "Search for:") %>
  <%= text_field_tag(:q) %>
  <%= submit_tag("Search") %>
<% end %>

Source : https://guides.rubyonrails.org/v5.0/form_helpers.html | Last Update : Sun, 26 Jan 20

Answers related to rails form tag

Code Explorer Popular Question For Ruby