Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Latest commit

 

History

History
29 lines (19 loc) · 740 Bytes

README.textile

File metadata and controls

29 lines (19 loc) · 740 Bytes

DefaultFindBy
=====

(Yet another) solution to literal URLs and permalinks.

After I found myself redefining to_param on my models and changing
controllers load code, I had created this plugin.

You give it a name of the field. It takes that name, defines to_param
to return value of that field, and makes find use
find_by_that_field when it is given the string.

Example
===

class Post < ActiveRecord::Base
  1. Post (id: integer, title: string, body: text)
    default_find_by :title
    end

Testing
===
To test this plugin, you’ll need rspec, rspec-rails and nakajima-acts_as_fu
gems installed.

Copyright © 2008 Artem Ignatiev, released under the MIT license