I'm new to slim and ruby on rails and trying to figure out how to disable a link_to if the condition isn't required.
f.actions do
= f.submit 'save data'
= link_to 'send data'
Here f, is a form that the user fills, and when the form condition is not met, that means submit asks user to fill some required field, I want link_to "send data" to be disabled How can I do that guys?
CodePudding user response:
Rails include multiple link_to
helpers to display a link if a specific condition is met.
link_to_if
https://apidock.com/rails/v5.2.3/ActionView/Helpers/UrlHelper/link_to_if
link_to_unless
https://apidock.com/rails/v5.2.3/ActionView/Helpers/UrlHelper/link_to_unless