Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
The simplest and most pointless rails plugin ever.
Ruby
tree: f35dba2444

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
README
init.rb

README

This is a silly plugin to let you take a shortcut.  Here's the blog post example:

class Post < ActiveRecord::Base
  define_find_param :slug
end

This will set the to_param to be post.slug and add the following method to the Post model:

def self.find_by_param(*args)
  find_by_slug(*args)
end

You can also pass :raise_on_not_found => true to have it raise ActiveRecord::RecordNotFound
if the result set is empty.

Like I said, it's silly, but I find myself using this pattern a lot.
Something went wrong with that request. Please try again.