Showing posts with label rails. Show all posts
Showing posts with label rails. Show all posts

Thursday, April 16, 2015

Single Sign on: Managing Authentication with Google, Twitter and Facebook accounts.


Last month on Tech Talk Tuesday we talked about setting up Single Sign on for websites.  Today's web solutions are based on a standard called OAuth2.  





It's not difficult to allow multiple login options to a site.  The Javascript library Passport works great for node.js applications.  The Oauth gem does the job for Ruby on Rails applications. And the WP-Oauth plugin is great for Wordpress sites.

What really impressed us was how easy it was to install and configure Oauth for Meteor applications.  Meteor is an impressive framework for setting up node.js applications quickly.  We'll be exploring it more soon.


Wednesday, February 24, 2010

will_paginate gem gets stuck on the first page.


Problem


The latest version of will_paginate ignores the page parameter using Rails > 2.2


recs = User.paginate, :page => 1 , :per_page => 1
recs2 = User.paginate, :page => 2 , :per_page => 1

assert_not_equal recs.first, recs2.first



Solution

Using the 'order' parameter fixes the problem:



recs = User.paginate, :page => 1 , :per_page => 1 , :order => 'username'
recs2 = User.paginate, :page => 2 , :per_page => 1 , : order => 'username'

assert_not_equal recs.first, recs2.first

Tuesday, December 8, 2009

undefined method `reflect_on_all_associations'

Using Rails 2.3.5 , I started recieving this error when running all unit tests on an older application.:


1) Error:
test_truth(CommitmentTest):
NoMethodError: undefined method `reflect_on_all_associations' for Object:Class


1 tests, 0 assertions, 0 failures, 1 errors


The problem was happening when Rails was trying to load fixtures. Removing all the fixures removed the error. After adding back a few at a time, I narrowed the problem down to the Fixtures for an object called Content :

The Content object has a field called type, which is reserved for Single Table Inheritance. renaming that field solved the problem.

The vague undefined method `reflect_on_all_associations' can have a variety of sources, In general, it means there's a problem with a Model object.

See Also:
http://iridescenturchin.wordpress.com/page/2/
http://sourceforge.jp/projects/rubycocoa/lists/archive/devel/2008-January/001293.html

Popular Articles