I've seen there're several engines and tutorials about it, but I couldn't figure out which one could help me out in short terms. I'm just learning Rails and Ruby and my aim is to understand how it works while it can be useful in a real life event.
Any link or explanation about this will be kindly appreciated!
RoR For Agile Project Development The web application development on Ruby on Rails allows taking required changes quickly without affecting the code and application quality. Usage of Ruby on Rails helps developers debug the code simultaneously while writing.
To generate a controller and optionally its actions, do the following: Press Ctrl twice and start typing rails g controller. Select rails g controller and press Enter . In the invoked Add New Controller dialog, specify the controller name.
Go to your browser and open http://localhost:3000, you will see a basic Rails app running. You can also use the alias "s" to start the server: bin/rails s . The server can be run on a different port using the -p option.
a gem called devise, as simple as install it and minimal configuration
https://github.com/plataformatec/devise
add it to gem file:
gemfile.rb
gem 'devise'
install :
rails generate devise:install
create User model:
rails generate devise user
and here are the commands you can use:
https://github.com/plataformatec/devise#controller-filters-and-helpers
Other answers are recommending Devise. Devise's own documentation says:
If you are building your first Rails application, we recommend you to not use Devise. Devise requires a good understanding of the Rails Framework. In such cases, we advise you to start a simple authentication system from scratch.
I'm inclined to agree. Devise is a great engine that can create a powerful login system for you in minimal time, but if you're building an app for the purpose of learning Rails, I'd recommend following a tutorial to build your own login system so you get a deeper understanding of what's actually going on beneath the hood. You can always come back and use Devise later.
For a tutorial, I'd recommend the same book that Devise recommend, Michael Hartl's Ruby on Rails Tutorial - specifically chapters 6, 7, 8. (Well, I'd recommend the whole book, but those are the chapters that pertain to building a login system.)
If screencasts are more your thing, Ryan Bates's Railscast on the subject is supposed to be good although I haven't watched it myself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With