module ActsAsLayoutable class WidgetBuilder < ActsAsLayoutable::Builder def method_missing(meth, *args, &block) self.item = ActsAsLayoutable::Widget.create!(:name => meth.to_s) ActsAsLayoutable::Widget.acts_as_configurable(meth, &block) if block_given? self.collection << self.item self.item.save self.item end end class Widget < ActiveRecord::Base belongs_to :area, :class_name => "ActsAsLayoutable::Area" end end