Sha256: 0e0f82862be00ebd7497d4c442710a94b41308fa738cbfca2d5c8c192af6902f
Contents?: true
Size: 554 Bytes
Versions: 8
Compression:
Stored size: 554 Bytes
Contents
module FriendlyId # Instance methods that will be added to all classes using FriendlyId. module Model attr_reader :current_friendly_id # Convenience method for accessing the class method of the same name. def friendly_id_config self.class.friendly_id_config end # Get the instance's friendly_id. def friendly_id send friendly_id_config.query_field end # Either the friendly_id, or the numeric id cast to a string. def to_param (friendly_id.present? ? friendly_id : id).to_s end end end
Version data entries
8 entries across 8 versions & 2 rubygems