Sha256: 6f3fcc6b5e998963f679c07dbfeb982fc036f68aaa924cfde45a3ba647992951

Contents?: true

Size: 438 Bytes

Versions: 1

Compression:

Stored size: 438 Bytes

Contents

require 'active_record'

module ActiveRecord
  class Base
    def self.blueprint(*args)
      options = args.extract_options!
      if args.present?
        klass = self
        Blueprints::Plan.new(*args) do
          klass.blueprint options
        end
      else
        returning(self.new) do |object|
          options.each {|attr, value| object.send("#{attr}=", value)}
          object.save!
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blueprints-0.2.0 lib/blueprints/ar_extensions.rb