ActsAsParam
===========
Example
=======
// In you model
class Product
acts_as_param :name, :serial
end
// How To Use
product = Product.create(:name => 'name',:serial => 'serial'}
product.to_param == 'name'
product = Product.create(:name => nil,:serial => 'serial'}
product.to_param == 'serial'
product = Product.create(:name => nil,:serial => nil}
product.to_param == product.id
product.find_by_param('serial') # find by product's serial
product.find_by_param('name') # find by product's name
product.find_by_param(2) # find by Product's primary key
product.find_by_param!('serial') # raise ActiveRecord::RecordNotFound exception if not found
Copyright (c) 2010 Jinzhu / wosmvp@gmail.com, released under the MIT license
Project
acts_as_param
acts as param
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
Development
Dependencies
Project Readme