Sha256: fc415f7d3ed648b3eb646d4c65409e3eb79456674a94c236080aa8556c649d47

Contents?: true

Size: 548 Bytes

Versions: 4

Compression:

Stored size: 548 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}
        has_one name, -> { where(:name => 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

4 entries across 4 versions & 1 rubygems

Version Path
polyblock-0.2.2 lib/polyblock/has_polyblock.rb
polyblock-0.2.1 lib/polyblock/has_polyblock.rb
polyblock-0.2.0 lib/polyblock/has_polyblock.rb
polyblock-0.1.8 lib/polyblock/has_polyblock.rb