16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/permalink_for.rb', line 16
def permalink_for(field, as: :pretty, reverse: false)
as = as.to_sym
unless PERMALINK_TYPES.has_key? as
raise "Unknown permalink type :#{as} (may be :slug or :pretty)"
end
include PERMALINK_TYPES[as]
self::ActiveRecord_AssociationRelation.include PERMALINK_TYPES[as]::ClassMethods
config = { target_field: field, reverse: reverse }
cattr_reader :permalink_configuration
class_variable_set(:@@permalink_configuration, config)
end
|