Sha256: 64c5fab45592a08c46d7afe96081ad50f857f931aa9adedd62bc379448424db3

Contents?: true

Size: 551 Bytes

Versions: 2

Compression:

Stored size: 551 Bytes

Contents

module Polyblock
  module HasPolyblock
    extend ActiveSupport::Concern

    included do
    end

    module ClassMethods
      def has_polyblock(name, options={})
        defaults = {:class_name => "Polyblock::Block", :as => :contentable, :conditions => {:name => name}}
        has_one name, defaults.merge(options)
        accepts_nested_attributes_for name
        include Polyblock::HasPolyblock::LocalInstanceMethods
      end
    end

    module LocalInstanceMethods
    end
  end
end

ActiveRecord::Base.send :include, Polyblock::HasPolyblock

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
polyblock-0.1.7 lib/polyblock/has_polyblock.rb
polyblock-0.1.6 lib/polyblock/has_polyblock.rb