Sha256: 3632130e256eee70c3c203460f6158f5d599432809834605c79326c83acf73a5
Contents?: true
Size: 597 Bytes
Versions: 2
Compression:
Stored size: 597 Bytes
Contents
require_relative 'core' module ActsAsHashids module Methods extend ActiveSupport::Concern module ClassMethods def acts_as_hashids(options = {}) include ActsAsHashids::Core unless ancestors.include?(ActsAsHashids::Core) define_singleton_method :hashids_secret do secret = options[:secret] (secret.respond_to?(:call) ? secret.call : secret) || base_class.name end define_singleton_method :hashids do length = options[:length] || 8 Hashids.new(hashids_secret, length) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
acts_as_hashids-0.1.1 | lib/acts_as_hashids/methods.rb |
acts_as_hashids-0.1.0 | lib/acts_as_hashids/methods.rb |