Sha256: 28d3a9e72c0e7dbff976f84dba0e69120ba9a12a81a16bfb022216e155b38b2f

Contents?: true

Size: 793 Bytes

Versions: 1

Compression:

Stored size: 793 Bytes

Contents

module Cheese
  module ActsAsWidget

    ## Define ModelMethods
    module Base
      def self.included(klass)
        klass.class_eval do
          extend Config
        end
      end
      
      module Config
        def acts_as_widget
        
          # This is where arbitrary code goes that you want to 
          # add to the class that declared "acts_as_widget"
          
          has_many :widgets,  :class_name => 'Cheese::Widget'

          include Cheese::ActsAsWidget::Base::InstanceMethods
        end
      end
      
      module InstanceMethods
        
        def factory_name
          "this is an example instance method"
        end
                
      end # InstanceMethods      
    end

  end
end

::ActiveRecord::Base.send :include, Cheese::ActsAsWidget::Base

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kealy_cheese-0.3.0 lib/acts_as_widget/base.rb