public
Description: Find_by_param is a nice and easy way to handle permalinks and dealing with searching for to_param values
Homepage:
Clone URL: git://github.com/bumi/find_by_param.git
Click here to lend your support to: find_by_param and make a donation at www.pledgie.com !
find_by_param / init.rb
100644 18 lines (13 sloc) 0.441 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'find_by_param'
class ActiveRecord::Base
  class_inheritable_accessor :permalink_options
  self.permalink_options = {:param => :id}
  
  #default finders these are overwritten if you use make_permalink in your model
  def self.find_by_param(value,args={})
    find_by_id(value,args)
  end
  def self.find_by_param!(value,args={})
    find(value,args)
  end
  
end
ActiveRecord::Base.send(:include, Railslove::Plugins::FindByParam)