Installing Devise after completing Michael Hartl's tutorial - ruby-on-rails

I'm planning on installing Devise and Cancan so I can implement some user/page authentication. I followed the Ruby on Rails Tutorial to start my website, so before I begin installing Devise, should I remove the user models/views that I already have from the tutorial? I'm not only worried about the overlap in the code and the security holes but also of breaking things.

You certainly can modify your existing User model to add devise functionality. Here's a brief write up on how to do it.
Here's a similar SO question and some relevant discussion

Related

Can I use "gem devise" and Michael Hartl rails tutorial authentication system together?

I have already finished Michael Hartl's rails tutorial and now I have a rails app which users can sign up with their information.
I want to add "Sign up with Facebook and Twitter" feature to my app. But when I tried it just usage of omniauth, I have got some problems.
Now I want to try it with using gem devise and gem omniauth together for adding "Sign up with Facebook and Twitter" feature, without changing my authentication system.
Is it possible? I will be also grateful if you advice different methods for adding omniauth.
Thanks for your attention
Yes you could use Devise and a custom authentication system together.
However I don't recommend you to implement two different authentication systems. It makes your app only unnecessarily complicated.
Here is a great Tutorial on how to use Omniauth together with Devise.
Hope this helps!
Happy coding :)

Which is the best way to create a login in Rails for a starter?

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!
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.
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

Implementing a chat application in Ruby on Rails

Basically, the app has to support sign up/sign in functionality and allow user to add friends and allow friends to chat.Since, I am just starting? with rails it's a bit overwhelming. How should I go about it
Also, the aim is not an application for production.
It'll be great if you could link to some working demos of the same.
Thanks!
If you are learning rails there are lots of great resources online. Try googling for a few.
I would suggest Michael Hartl's Rails Tutorial - http://ruby.railstutorial.org/ruby-on-rails-tutorial-book - it includes bits of what you want.
You would need ofcourse to read tutorials for rails beginners, I recommend the official rails guide.
For sign up/sign in, you could use the devise gem, and for chat push you could take a look at private_pub gem.
You can also check out a tutorial I did on how to achieve the same using devise and private_pub gem. I believe this should get you started http://goo.gl/l3e8zN

Rails 3 authentication solutions

I poked around StackOverflow and Google, but couldn't find anyone who has put together a comparison of authentication gems or plugins for Rails (I'm looking for something for Rails 3). What authentication solutions are available for Rails 3, which are most popular, and what are the differences between them?
Ruby toolbox has a list of the most popular ones: http://ruby-toolbox.com/categories/rails_authentication.html
You can see that Devise and Authlogic are definitely the most popular.
Personally I use Devise. It works well with Rails 3, is easily customizable, and makes it very easy to integrate Twitter and Facebook based auth.
For a Rails3 App definitely Devise ;).
Devise is the only authentication system which provides security on all the 3 stack layers of rails: - In 'M', 'v', and 'C' and hence the best to go with. But you got to learn more on how to customize devise to custom fit your application's need. You can find help on customizing in this page https://github.com/plataformatec/devise/wiki/_pages
In Rails authentication from scratch is dead simple to do.
Ryan Bates covers this here http://railscasts.com/episodes/270-authentication-in-rails-3-1
devise, devise, devise
I am surprised OminAuth did not get a mention in any of the answers. (Agreed OmniAuth is more recent than this question is, but there are answers that came after)
Undoubtedly, this is the most exhaustive authentication solution available currently for rails applications.
Under the hood, OmniAuth uses OAuth2, which is evolving as the de-facto standard for authentication in web applications across platforms and frameworks. Almost all major internet players support OAuth2 - Github, Google, Facebook, Twitter, LinkedIn are just a few to name.
Of course, Devise works very well with OmniAuth so It should not be a major headache for those already using Devise
I'm a big proponent of rolling your own. Depending on your requirements its fairly straight-forward and reduced dependency on a key component. Rails 3.1 makes it even easier.
Kinda late to the party, but I wrote something up for it here:
http://zergsoft.blogspot.jp/2012/08/rails-3-authentication-compared-warden.html
I cover Warden, Devise and home grown.
The tutorial by Michael Hartl is great for learning how to set up your own.
http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
I have used that on multiple apps and love the flexibility of setting up my own Authentication Method.
Though for the most part I use Devise and LOVE it. It is very quick/easy to implement, very secure, and does exactly what I need it do.
https://github.com/plataformatec/devise
I will typically use it in conjunction with CanCan and Rolify

Problem with Devise authentication on Rails

I tried to use Devise 1.0.6 over Rails 2.3. I followed the installation instructions and the user can successfully sign up. However, when I use the registered user account to sign in, the password field is cleared up and nothing happened. Could anyone give me some ideas? Thanks in advance.
Without any further detail the only thing I can advice is to follow Ryan Bates screencast on Devise maybe it can point you to the right direction (even if he uses Rails 3.0 instead of 2.3):
Screencast
Textual Version

Resources