Rails3 OAuth Plugin - ruby-on-rails

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.

Related

Can React on Rails be integrated into an existing Rails 3.x app?

The prerequisites from the README say "React on Rails supports older versions of Rails back to 3.x" so I was led to believe it could. But then during the install process I see I have to install webpacker. And there's the note "Rails/webpacker requires version 4.2+."
So I'm currently stalled out and wondering if this really does support Rails 3.x or if I misunderstood the documentation.
Is there a way to integrate React on Rails into an existing Rails 3.x app?
Thank you!
According to justin808 on the corresponding GitHub issue for this question:
"React on Rails should not require rails/webpacker.
Just use the asset pipeline."
I guess I misunderstood that rails/webpacker was a hard dependency. Trying again now to get react_on_rails working without it. I'll mark this as the accepted answer, at least for now.

how to create web service Api in rails 4?

can anyone help me how to create a web service API in rails 4. I know how create web service API in ruby 1.8.7 and rails 2.3.5 with action web service gem. When I am trying to use https://github.com/datanoise/actionwebservice gem in rails 4, I am getting deprecated errors.I want to upgrade my web service app. Please help me.
Rails-API looks promising, because it will be part of Rails core in Rails 5.
Rails-API
Rails-API is a subset of a normal Rails application, because API only applications don't require all functionality that a complete Rails application provides. so, it compatible well with old Rails versions. I don't know compatibility exactly, but I'm using it with Rails 3.2.x
There are another proper framework for this purpose, for example, Sinatra, Grape, but If you familiar with Rails, Rails-API will be the best choice.
Actionwebservice is long deprecated, in favour of REST API's. At my previous job we used a fork of actionwebservice in a rails 3 project.
Since there is no maintainer anymore for the actionwebservice gem, that fork never got merged back. If you check the fork history, a lot of people are fixing and partially updating it, but it is scattered all over the place.
Afaik none of the forks were updated to use rails 4. But using a rails 3 fork might just work.
If you really need to build a SOAP API server with Rails, imho your best option is to take a look at Wash-out, but you will have to re-write your API code.

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.

JasmineRice on Rails 4

Has anyone tried JasminRice gem with Rails 4?
I've got Ember Rails 4 app and I would like to use Jasmine Rice but I'm not sure whether it would work out well as their Github account says Pain free coffeescript testing under Rails 3.1
Jasmine Rice
I would advice you to use jasmine-gem, which recently gained Rails 4 support. jasmine-gem is developed by Pivotal, the company that develops Jasmine itself, and is actively maintained. While this gem was very basic for a long time, it has improved tremendously, especially with version 2.0.0. Spec execution in Phantomjs (in addition to the browser, which is the fastest for development) is supported, and there is full integration into the Asset Pipeline, which lets you e.g. write tests in CoffeeScript. At my student job, we are using jasmine-gem extensively and are very happy with it.
In the jasminerice installation section they mention that it should work on rails 4:
This gem has been tested and run with Rails 3.1 and 3.2. It should
also run on Rails 4.
"Should" is not as strong of a word as I would like, but I have a ember rails 4 app and jaminerice has not given me any issues.

In Rails, is restful_authentication a gem comparable to AuthLogic and OmniAuth?

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.

Resources