Sha256: 355efa5a2b95b66a090f1ba98badb72a854f53d0cbc892bee222df9b2088acc8

Contents?: true

Size: 739 Bytes

Versions: 5

Compression:

Stored size: 739 Bytes

Contents

module Permalink
  module Orm
    module ActiveRecord
      def self.included(base)
        base.extend(ClassMethods)
        base.extend(Permalink::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 Permalink::Orm::Base::InstanceMethods
          setup_permalink(
            {:to_param => [:id, :permalink]},
            from,
            options
          )
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
permalink-1.2.1 lib/permalink/orm/active_record.rb
permalink-1.2.0 lib/permalink/orm/active_record.rb
permalink-1.1.2 lib/permalink/orm/active_record.rb
permalink-1.1.1 lib/permalink/orm/active_record.rb
permalink-1.1.0 lib/permalink/orm/active_record.rb