funkensturm / acts_as_identifiable

Identifies a Model by full-text checking one field (usually for a User not providing a full username, but just a part of it)

This URL has Read+Write access

name age message
file MIT-LICENSE Sat Feb 14 03:14:15 -0800 2009 git commit -m 'first commit' [funkensturm]
file README.textile Loading commit data...
file Rakefile Sat Feb 14 03:14:15 -0800 2009 git commit -m 'first commit' [funkensturm]
file init.rb Sat Feb 14 03:14:15 -0800 2009 git commit -m 'first commit' [funkensturm]
directory lib/
directory test/ Fri Feb 20 13:11:09 -0800 2009 readme tweaks [funkensturm]
README.textile

Introduction

Imagine something specific as this now. You have a list of users and you want to identify one of them without having to enter the exact 100% same user name.

So you use this small acts_as_identifiable plugin to work with your model:

class User < ActiveRecord::Base acts_as_identifiable :column => ‘my_username’ end

And this is what it will do:

  1. Search for an exact match
  2. Search for an estimate match
    1. If only one user matched, return it
    2. If not, the user will have to provide more data

I just realize this is hard to explain!

Please rather refer to the Unit Test to see what I’m takling about.

Actually, even better, check out the demo application at www.github.com/funkensturm/funkengallery_demo :)