I'm using the Adauth gem to perform authentication against our Active Directory for a site that backs to an HBase cluster. At this point we're not really concerned with storing additional user data, we just want the authentication functionality.

It'd be pretty easy to create a login form with no model except then I'd have to handle exceptional situations (validation!) outside of the typical flow which makes skipping the model ultimately just cost me extra time in the form of more work. I'm also using Formtastic, specifically Bootstrap-Formtastic, and I really like consistency in my application.

So based on this article I implemented a database-less ActiveRecord model so I could utilize semanticformfor and remain consistent with the rest of my application.

#./app/controllers/sessions_controller.rb  
class SessionsController < AdAuthController  
  before_filter :check_authentication, :except => [ :new, :create, :destroy ]
  ⋮
  class LoginUser < ActiveRecord::Base
    validates :username, :presence => true
    validates :password, :presence => true

    def self.columns
      @columns ||= []
    end
    def self.column(name, sql_type = nil, default = nil, null = true)
      columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
    end

    column :username, :string
    column :password, :string
  end
end  

And since I'm using an embedded class its important to remember to specify the correct symbol in the parameters:

#./app/controllers/sessions_controller.rb  
  ⋮
  def create
    @login_user = LoginUser.new(params[:sessions_controller_login_user])
    ⋮
  end
  ⋮

Because we are backing to a HBase cluster I expect this isn't the last time I'll need to use this approach on our project.