August 2025
Intermediate to advanced
270 pages
6h 16m
English
Start by adding the HTML markup to the sign-in form. Open app/views/sessions/new.html.erb in the Rails app and add the controller data attribute to the submit button.
| | <% content_for :title, "Sign in" %> |
| | |
| | <div class="container d-flex flex-column mw-400 mx-auto"> |
| | <h1 class="h3 d-hotwire-native-none my-4 mx-auto"> |
| | Sign in to your account |
| | </h1> |
| | |
| | <%= form_with url: session_path, class: "row g-3 mt-1" do |form| %> |
| | <%# ... %> |
| | |
| | <div> |
| » | <%= form.submit "Sign in", class: "btn btn-primary w-100", data: { |
| » | controller: "bridge--button" |
| » | } %> |
| | </div> |
| | <% end %> |
| | </div> |
Data Attributes in Rails | |
|---|---|
|
In Rails we can write data attributes ... | |
Read now
Unlock full access