Sha256: 7da351a64fa55af00bbd2a4bae778d2a025a6b855a46c460ad7966472ce53e2c

Contents?: true

Size: 745 Bytes

Versions: 4

Compression:

Stored size: 745 Bytes

Contents

module Permalinker
  module Orm
    module ActiveRecord
      def self.included(base)
        base.extend(ClassMethods)
        base.extend(Permalinker::Orm::Base::ClassMethods)
        class << base; attr_accessor :permalink_options; end
      end

      module ClassMethods
        # permalink :title
        # permalink :title, :to => :custom_permalink_field
        # permalink :title, :to => :permalink, :to_param => [:id, :permalink]
        # permalink :title, :unique => true
        def permalink(from, options={})
          include Permalinker::Orm::Base::InstanceMethods
          setup_permalink(
            {:to_param => [:id, :permalink]},
            from,
            options
          )
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
permalinker-1.0.3 lib/permalinker/orm/active_record.rb
permalinker-1.0.2 lib/permalinker/orm/active_record.rb
permalinker-1.0.1 lib/permalinker/orm/active_record.rb
permalinker-1.0.0 lib/permalinker/orm/active_record.rb