Frage

Anyone know how I can make a login button in Ruby on Rails for an application?

I assume the redirection will be something like:(I'm using current elements)

<%= link_to 'Log In', index_path, :class => 'btn btn-primary'%>

However, this will just create a button that redirects to the index, regardless if the "user" has filled in the required "Email" and "Password" fields. I assume I'll need a condition to check if the fields are filled and I assume a database table for accepted e-mails with the correct passwords?

War es hilfreich?

Lösung

There are actually several ways to handle authentication and user roles, I would suggest searching around for Devise to start with. after you understand how they are managed you might try yourself using DB relations or session hashes.

Have fun learning:

https://github.com/plataformatec/devise
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top