Sha256: 491021cd129355697f9ee9741ad4e990f189bc7260809dfa02009b67e5128161

Contents?: true

Size: 506 Bytes

Versions: 1

Compression:

Stored size: 506 Bytes

Contents

module ActsAsLayoutable
  
  class AreaBuilder < ActsAsLayoutable::Builder
    
    def method_missing(meth, *args, &block)
      self.item = ActsAsLayoutable::Area.create!(:name => meth.to_s)
      args.each do |widget|
        self.item.widgets << ActsAsLayoutable::Widget.find_or_create_by_name(widget.to_s)
      end
      self.collection << self.item
      self.item.save
      self.item
    end
    
  end
  
  class Area < ActiveRecord::Base
    belongs_to :layout
    has_many   :widgets
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts-as-layoutable-0.0.1.7 lib/acts-as-layoutable/area.rb