Michael de Silva's Blog

Software Engineer. Rubyist and Roboticist.

Michael de Silva's Blog

Software Engineer. Rubyist and Roboticist.

Lazy User Registration for Rails Apps

Do not miss this fantastic post detailing how to go about lazy user registration for rails apps and the example provided is based on the ever popular Devise — the concept is clean and well explained enough to be adapted to any auth system of your choice.

As an addendum, that may not be clear right off the bat, is the User model should have

class User < ActiveRecord::Base
  ACCESSIBLE_ATTRS = [:name, :email, ...]
  attr_accessible *ACCESSIBLE_ATTRS
end

That's why the AnonymousUser lists the User's attributes as accessible albeit as the 'registrant' role.

comments powered by Disqus