lib/happy/extras/resources.rb in happy-0.1.0.pre23 vs lib/happy/extras/resources.rb in happy-0.1.0.pre24

- old
+ new

@@ -1,12 +1,10 @@ module Happy module Extras module Resources - module ControllerExtensions - def resource(klass, options = {}, &blk) - run ResourceMounter, options.merge(:class => klass), &blk - end + def resource(klass, options = {}, &blk) + run ResourceMounter, options.merge(:class => klass), &blk end class ResourceMounter < Happy::Controller def root_url super(options[:plural_name]) @@ -93,24 +91,22 @@ def route options[:singular_name] ||= options[:class].to_s.tableize.singularize options[:plural_name] ||= options[:class].to_s.tableize.pluralize - path options[:plural_name] do - get('new') { do_new } + on options[:plural_name] do + on_get('new') { do_new } - path :id do - get { do_show } - post { do_update } - get('edit') { do_edit } + on :id do + on_get { do_show } + on_post { do_update } + on_get('edit') { do_edit } end - post { do_create } - get { do_index } + on_post { do_create } + on_get { do_index } end end end end end end - -Happy::Controller.send(:include, Happy::Extras::Resources::ControllerExtensions)