In Rails, is restful_authentication a gem comparable to AuthLogic and OmniAuth? - ruby-on-rails

Two books (Learning Rails and Foundation Rails) both use restful_authentication gem / plugin to do user registration / activation. Is it a gem comparable to AuthLogic and OmniAuth?
Is it still a good useable plugin for doing so and work well with Rails 3? I thought GEM is the preferred method, and restful_authentication moved to github and it can be installed only as a plugin?

restful_auth is a rails plugin. It pollutes your code because it generates code.
authlogic is newer than restful_auth. It's a gem instead of rails plugin so your code is much cleaner than using restful_auth
omniauth is a newer gem than authlogic but it uses external provider e.g OpenID, OAuth, etc, instead of your database.
The latest authlogic works well with Rails 3 with a few hitch.

Related

How i can use Mailchimp API directtly without using Rails Gem

I'm using Rails 3.2.11 and Ruby 1.9.3. I want to subscribe user to
mailchimp. But when i use gems like(gibbon and mailchimp_api).There are
too many dependencies issues. Mailchimp developer guide not help me too
much.I spent many days but not solve these issues.
How can i make direct api calls to mailchimp for subscribe users?
Any help?
Resolving your dependency issues with Gibbon should be a cinch: it only relies on two things:
gem 'faraday', '>= 0.9.1'
gem 'multi_json', '>= 1.11.0'
If you're unable to use a recent version of each of those, you probably have something else awry.
As for working with Mailchimp directly, their developer guides do a great job of walking you through how to obtain API tokens for other users using OAuth2 and explaining the endpoints that are available. You then just need to make HTTP requests (e.g. with Faraday v0.9.1 or greater), parse the responses (e.g. with multi_json 1.11.0 or greater) and write logic to handle errors.
If you want to get started faster, you could look at the source for Gibbon. You can even get away with copy-pasting the entirety of Gibbon into a gem of your own naming and modify the code to not rely on those dependencies.
...when i install gibbon then i need to move my ruby version from 1.9.3 to 2.1.3
You can use an earlier version of Gibbon that supports Ruby 1.9.3. It looks like the last version to support Ruby 1.9.3 is Gibbon 1.2.1.

Authentication gem to use for Neo4j and Rails 4?

Any suggestions regarding implementation of authentication mechanism in a project using Rails 4 and Neo4j?
gem devise-neo4j https://github.com/benjackson/devise-neo4j/ is no longer mantained
Unable to find any good resource describing the implementation of authentication mechanism in Rails 4.0
In your Gemfile, use gem 'devise-neo4j', "~> 2.0.0.alpha.1". It was updated earlier this year to support Neo4jrb v3.

The rails way of doing client side validation (Rails 4 with simple_form)

I am new to Rails and using Rails 4. I have started some forms for creating/editing some models and have added some validation which works fine on the server side.
I assumed that Rails would have something built in to handle client side validation - turns out it doesn't.
I have searched on google and found 'client_side_validation' which is no longer maintained and I don't think works in Rails 4 anyway.
There doesn't seem to be an obvious go to library for Rails client side validation. So what is the 'Rails way' of handling this? Roll your own? Duplicate the logic client side using jQuery? Use html5 validation and fall back to server side when it isn't their? Or is there a library (preferably one that works with simple_form) that I can just install and use?
There is client_side_validations, but is not longer maintained. Probably the best way is using some jQuery plugin like jquery-validation.
Rails 4 + Simple form : To install "Client side validations" with simple_form successfully, you should check for latest versions direct from Github with latest branch.
The released gems don't work with Rails >= 4.0
gem 'client_side_validations', github: 'DavyJonesLocker/client_side_validations'
gem 'client_side_validations-simple_form', github: 'DavyJonesLocker/client_side_validations-simple_form'
Make sure your gem file does not use these versions
client-side Validation 3.2.5
client_side_validations-simple_form 2.1.0
These versions does not support rails 4.2.0
For more detail please check this link,
https://github.com/DavyJonesLocker/client_side_validations-simple_form/issues/41
One way to achieve this is in Rails 4 is to use the client side validation gem: http://rubygems.org/gems/rails4_client_side_validations
This guy here is using it: Client Side Validations and Rails4
Railscasts provides a good tutorial (Rails 3) on it here:
http://railscasts.com/episodes/263-client-side-validations
I was able to use a fork of the original client_side_vlaidations that is very active at the moment. I am using the latest version of simple_form, rails 4.1.8, and this client_side_validations. Simple setup with basic config.

authlogic open-id with Rails 3.2

Has anyone been able to get the authlogic open-id gems to work in Rails 3. I am using Rails 3.2 and running into various issues.
I will post the solutions I find as I make progress.

Rails3 OAuth Plugin

Hi I installed OAuth Plugin on my Rails 3 app to turn it into an OAuth Provider.
I followed the instruction from https://github.com/pelle/oauth-plugin under Rails 3.
But, under the instructions it says the following:
It requires an authentication framework such as acts_as_authenticated, restful_authentication or restful_open_id_authentication. It also requires Rails 2.0.
I am puzzled by the fact that it says Rails 2.0 is required. Do I have to install Rails 2.0 as well somehow? Thanks
No, it shouldn't.
Make sure you have something higher than 0.4.0 in your Gemfile, as the instruction say
gem "oauth-plugin", ">= 0.4.0.pre1"
Rails 3 will never allow you to load Rails 2, its going to implode.

Resources