Rememberable in Devise Rails 4 - ruby-on-rails

I have seen a few posts about this but none that truly seem to answer what I'd like to understand which is – "How do I know rememberable is working the way I think it should be?"
While testing in localhost using the EditThisCookie chrome extension, I am able to see that a remember_user_token is being created but how do I know before pushing this to staging that it's working correctly?
Maybe I'm being a little too broad for the likings for stackoverflow but I didn't want to make this into a long-winded post where I post my code and ask someone to dissect it – that's not my intention. More than anything, I'm looking for some guidelines maybe even a great blog post/tutorial that explains setting this up step-by-step so I can wrap my head around if it's working and the how/why behind it. Thanks in advance and I apologize if my approach was not the best. I'd be happy to provide more information for some feedback/maybe tips to consider that I didn't consider previously.

There are some tests within the devise gem that ensure the rememberable is working as expected. You can read at them here:
https://github.com/plataformatec/devise/blob/master/test/integration/rememberable_test.rb
Let me know if I'm missing some part of the question :)

Related

authentication page in rails?

I have tried few examples in rails and it went wrong in some way. Finally i looked at https://github.com/plataformatec/devise_example.git , which works correctly but i find it difficult to understand how it works or the process of getting it done. So if someone can help me by explaining the steps involved in the same example if possible or the other, i can understand it. Thanks.
You might want to watch the RailsCasts episode on Devise: http://railscasts.com/episodes/209-introducing-devise

Apotomo alternative

The information on the home page of the project I'm working has been piling up that now we are looking for something to create a dashboard-like interface.
That's how I found Apotomo, but I'm wondering what would be some alternatives worth looking into.
So far, I've looked through the Rails Presenters on ruby-toolbox.
Thankful for any suggestions to speed-up the development.
ActiveAdmin has a nice dashboard, might be worth checking out. Here it is on their demo and the commented code

How to setup facebook-connect for authlogic in rails3?

I have been searching a lot on the net to get facebook-connect integrated with authlogic in rails3. There are a number of solutions based on facebooker, oauth etc. but none of them seem to say anything on whether they work with rails 3 or not. Can anyone guide to me on how to get facebook-connect working with authlogic in "rails3". I see that there are a lot of questions related to this on the site but none seems to have actually answered the question.
I strongly recommend you to use http://www.janrain.com/products/engage with this gem https://github.com/tardate/authlogic_rpx. This combo works amazing with two of my projects and it is free if you only want to use authentication (like in my case).
PS. look at railscast: http://railscasts.com/episodes/233-engage-with-devise. I know that, this podcast show how to use Janrain with Devise, but it helped me with Authlogic so it also can help you.

Solution for comments for a Rails application

I'm introducing comments into a Rails application, and, being exceptionally lazy, I'm looking for a plugin to do it for me. I came across acts-as-commentable, but I didn't find much else. Acts-as-commentable seems fine, but it doesn't have support for threading.
Of course, it wouldn't be too hard just to home-brew the entire thing, but I think that surely commenting is such a common feature that there should be a canonical plugin to handle it. Can somebody with perhaps more Google Fu than me point me in the right direction?
This is acts_as_commentable_with_threading plugin which help you for threaded comment.
Link::
http://github.com/elight/acts_as_commentable_with_threading
The most lazy approach would be to use third-party commenting system like DISQUS : just copypaste a couple of javascripts and you're done.
Surely, it can't be used if your app has an authentication system of its own.
If you do not want to integrate a third-party service like Disqus, you have Juvia The Comments and Commontator. Also you can count with opinio as alternative. but only with Rails 3 and at the moment and as notice the development seems stalled.

Best Solution For Authentication in Ruby on Rails [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm looking for a pre-built solution I can use in my RoR application. I'm ideally looking for something similar to the ASP.NET Forms authentication that provides email validation, sign-up controls, and allows users to reset their passwords. Oh yeah, and easily allows me to pull the user that is currently logged into the application.
I've started to look into the already written pieces, but I've found it to be really confusing. I've looked at LoginGenerator, RestfulAuthentication, SaltedLoginGenerator, but there doesn't seem to be one place that has great tutorials or provide a comparison of them. If there's a site I just haven't discovered yet, or if there is a de-facto standard that most people use, I'd appreciate the helping hand.
AuthLogic appears to be the new kid on the block and seems to be the next evolution of restful_authentication, easier to use, etc
http://github.com/binarylogic/authlogic/tree/master
Edit: now that Rails 3 is out, Devise seems to be the new, new kid on the block
https://github.com/plataformatec/devise
or I have been rolling my own authentication now with the has_secure_password built in to Rails http://railscasts.com/episodes/250-authentication-from-scratch-revised
Side note: Ruby Toolbox is a great site for finding the current best solution in various categories (based on the number of GitHub watchers):
http://ruby-toolbox.com/categories/rails_authentication.html
I would really recommend Restful Authentication. I think it's pretty much the de-facto standard.
For a really simple solution go with Clearance.
If you are looking for more options Devise is a great solution. It uses Warden which is a rack based authentication system.
There's also RestfulOpenIDAuthentication if you want OpenID support in addition to password support.
Just a note, LoginGenerator and SaltedLoginGenerator have been superseded by Restful Authentication and are unsupported on newer Rails releases -- dont waste any time on them, though they were great at the time.
I'd also like to point out an excellent tutorial/discussion on extending the core functionality of Restful Authentication, in case you're looking for something a bit more robust.
I'm really liking thoughtbot's clearance. Very simple and has a few good hooks and is testable.
AuthLogic seems to be what you want for this. It's very configurable, and although it doesn't generate the code for you, it's quite easy to use. For email validation and password recovery you probably want to use the :perishable_token column. AuthLogic takes care of it, you only need to reset it when it's used. For information on how to set up a basic app, you can take a look at Ryan Bates' Railscast on AuthLogic, and the "official" example app. Ben Johnson, the creator of AuthLogic has also written a blog post on how to RESTfully reset passwords.
Unfortunately I can't post more than one link, but the links to the railscast, the password reset blog post and the example app are all in the README (see the AuthLogic repo for the README)
Update: Now I can post more links, so I linked some more. Thank you marinatime for adding the link in the meanwhile
restful_authentication is a powerful tool which is very flexible and provides most of what you are looking for out of the box. However, a couple of caveats:
Don't think in terms of 'controls'. In Rails the Model, View and Controller are much more independent than in 'Webforms-style' ASP.NET. Work out what you want from each layer independently, write tests/specs to match and make sure each layer is doing what you expect.
Even if you are using a plugin there is no substitute for reading (at least some) of the code generated. If you have a big-picture idea of what is going on under the hood, you will find debugging and customising much easier.
The plugin restful_authentication and other plugins that extend it, answer your needs perfectly. A quick search on github.com will reveal a lot of tutorials, examples, and extensitons. Just go here:
- http://github.com/search?q=restful_authentication
There are several projects that use restful_authentication just to provide examples of a bare-bones Rails app with just the authentication parts.
http://github.com/fudgestudios/bort -- A base rails app featuring: RESTful Authentication
http://github.com/mrflip/restful_authentication_example -- Another project with a great examlpe of how to use restful_authentication
http://github.com/activefx/restful_authentication_tutorial -- Same as above, with some other plugins bundled.
http://railscasts.com/episodes/67-restful-authentication -- a great screencast explaining restful_authentication
This information should be enough to get you started finding heads and tails ... good luck.
Just updating this: Ryan Bates' Railscast #250 shows building an authentication system from scratch....
Another vote for Clearance - perhaps not as customisable or as 'in' as authlogic, but in terms of just being able to drop it in place and go, it's definitely worth having a look at.

Resources