Module: Railslove::Plugins::FindByParam::ClassMethods

Defined in:
lib/spree_core/find_by_param.rb

Instance Method Summary collapse

Instance Method Details



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/spree_core/find_by_param.rb', line 43

def make_permalink(options={})
  options[:field] ||= "permalink"

  if self.column_names.include?(options[:field].to_s)
    options[:param] = options[:field]
    before_validation(:on => :create){ save_permalink }
  end

  self.permalink_options = options
  extend Railslove::Plugins::FindByParam::SingletonMethods
  include Railslove::Plugins::FindByParam::InstanceMethods
rescue
  # Database is not available (not a problem if we're running rake db:create or rake db:bootstrap)
end