How do I know what arguments url helpers take in Rails? For example, how do I know url helper takes just one parameter below? I know these methods are metaprogrammed but where i
Here is the API doc. It contains link_to, button_to, link_to_unless, link_to_unless_current, current_page?, and mail_to.
link_to(name = nil, options = nil, html_options = nil, &block)
link_to(body, url, html_options = {})
# url is a String; you can use URL helpers like posts_path
Options
:data - This option can be used to add custom data attributes.
method: symbol of HTTP verb - This modifier will dynamically create an HTML form and immediately submit the form for processing using the HTTP verb specified. Useful for having links perform a POST operation in dangerous actions like deleting a record (which search bots can follow while spidering your site). Supported verbs are :post, :delete, :patch, and :put. Note that if the user has JavaScript disabled, the request will fall back to using GET. If href: '#' is used and the user has JavaScript disabled clicking the link will have no effect. If you are relying on the POST behavior, you should check for it in your controller's action by using the request object's methods for post?, delete?, :patch, or put?.
remote: true - This will allow the unobtrusive JavaScript driver to make an Ajax request to the URL in question instead of following the link. The drivers each provide mechanisms for listening for the completion of the Ajax request and performing JavaScript operations once they're complete
Data attributes
confirm: 'question?' - This will allow the unobtrusive JavaScript driver to prompt with the question specified. If the user accepts, the link is processed normally, otherwise no action is taken.
:disable_with - Value of this parameter will be used as the value for a disabled version of the submit button when the form is submitted. This feature is provided by the unobtrusive JavaScript driver.