Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # lib/active_record_ext.rb
- module ActiveRecordExtensions
- def self.included(base)
- base.extend(ClassMethods)
- end
- # attempts to create an 'html-friendly' id
- def to_html_param(include_class_name = true)
- if include_class_name
- "#{self.class.name.parameterize.underscore}_#{self.to_s.parameterize.underscore}"
- else
- self.to_s.parameterize.underscore
- end
- end
- module ClassMethods
- # nothing, at the moment
- end
- end
- ActiveRecord::Base.send(:include, ActiveRecordExtensions)
Add Comment
Please, Sign In to add comment