<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/merb_resource_controller/action_descriptor.rb</filename>
    </added>
    <added>
      <filename>spec/mrc_test_app/spec/lib/action_descriptor_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -200,57 +200,62 @@ how the controllers behave. Of course you are also free to override all the meth
 &lt;pre&gt;
 &lt;code&gt;  
 def index
+  set_action_specific_provides(:index)
   load_resource
   display requested_resource
 end
 
 def show
+  set_action_specific_provides(:show)
   load_resource
   raise Merb::ControllerExceptions::NotFound unless requested_resource
   display requested_resource
 end
 
 def new
-  only_provides :html
+  set_action_specific_provides(:new)
   load_resource
   set_member(new_member)
   display member
 end
 
 def edit
-  only_provides :html
+  set_action_specific_provides(:edit)
   load_resource
   raise Merb::ControllerExceptions::NotFound unless requested_resource
   display requested_resource
 end
 
 def create
+  set_action_specific_provides(:create)
   load_resource
-  set_member(new_member(params[member_name]))
+  set_member(new_member)
   if member.save
-    on_successful_create
+    handle_successful_create
   else
-    on_failing_create
+    handle_failed_create
   end
 end
 
 def update
+  set_action_specific_provides(:update)
   load_resource
   raise Merb::ControllerExceptions::NotFound unless requested_resource
   if requested_resource.update_attributes(params[member_name])
-    on_successful_update
+    handle_successful_update
   else
-    on_failing_update
+    handle_failed_update
   end
 end
 
 def destroy
+  set_action_specific_provides(:destroy)
   load_resource
   raise Merb::ControllerExceptions::NotFound unless requested_resource
   if requested_resource.destroy
-    on_successful_destroy
+    handle_successful_destroy
   else
-    on_failing_destroy
+    handle_failed_destroy
   end
 end
 &lt;/code&gt;
@@ -261,20 +266,48 @@ h2. Additional Methods to override
 In addition to the actions and the methods they are using, you will probably want to override some other methods that
 @merb_resource_controller@ uses to do its thing. Here are some default method implementations you can override to this effect:
 
+h3. Customize the create action
+
 &lt;pre&gt;
 &lt;code&gt;
-# Customize the create action
+def handle_successful_create
+  handle_content_type(:create, content_type, :success)
+end
+
+def handle_failed_create
+  handle_content_type(:create, content_type, :failure)
+end
 
-def on_successful_create
+
+def html_response_on_successful_create
   options = flash_messages_for?(:create) ? { :message =&gt; successful_create_messages } : {}
   redirect redirect_on_successful_create, options          
 end
-
-def on_failing_create
+        
+def html_response_on_failed_create
   message.merge!(failed_create_messages) if flash_messages_for?(:create)
-  render :new, :status =&gt; 406
+  render :new, :status =&gt; 406         
+end
+
+        
+def xml_response_on_successful_create
+  display member, :status =&gt; 201, :location =&gt; resource(member)
+end
+        
+def xml_response_on_failed_create
+  display member.errors, :status =&gt; 422
+end        
+
+     
+def json_response_on_successful_create
+  display member, :status =&gt; 201, :location =&gt; resource(member)         
+end
+        
+def json_response_on_failed_create
+  display member.errors, :status =&gt; 422
 end
 
+
 def redirect_on_successful_create
   target = singleton_controller? ? member_name : member
   resource(*(has_parent? ? parents + [ target ] : [ target ]))
@@ -292,19 +325,50 @@ end
 def failed_create_messages
   { :error =&gt; &quot;Failed to create new #{member.class.name}&quot; }
 end
+&lt;/code&gt;
+&lt;/pre&gt;
 
-# Customize the update action
+h3. Customize the update action
 
-def on_successful_update
-  options = flash_messages_for?(:update) ? { :message =&gt; successful_update_messages } : {}
-  redirect redirect_on_successful_update, options
+&lt;code&gt;
+&lt;pre&gt;
+def handle_successful_update
+  handle_content_type(:update, content_type, :success)
+end
+
+def handle_failed_update
+  handle_content_type(:update, content_type, :failure)
 end
 
-def on_failing_update
+
+def html_response_on_successful_update
+  options = flash_messages_for?(:update) ? { :message =&gt; successful_update_messages } : {}
+  redirect redirect_on_successful_update, options       
+end
+        
+def html_response_on_failed_update
   message.merge!(failed_update_messages) if flash_messages_for?(:update)
   display requested_resource, :edit, :status =&gt; 406
 end
 
+        
+def xml_response_on_successful_update
+  &quot;&quot; # render no content, just 200 (OK) status.
+end
+        
+def xml_response_on_failed_update
+  display member.errors, :status =&gt; 422
+end        
+
+     
+def json_response_on_successful_update
+  &quot;&quot; # render no content, just 200 (OK) status.
+end
+        
+def json_response_on_failed_update
+  display member.errors, :status =&gt; 422
+end
+
 def redirect_on_successful_update
   target = singleton_controller? ? member_name : member
   resource(*(has_parent? ? parents + [ target ] : [ target ]))
@@ -322,18 +386,36 @@ end
 def failed_update_messages
   { :error =&gt; &quot;Failed to update #{member.class.name}&quot; }
 end
+&lt;/code&gt;
+&lt;/pre&gt;
 
-# Customize the destroy action
+h3. Customize the destroy action
 
-def on_successful_destroy
-  options = flash_messages_for?(:destroy) ? { :message =&gt; successful_destroy_messages } : {}
-  redirect redirect_on_successful_destroy, options
+&lt;code&gt;
+&lt;pre&gt;
+def handle_successful_destroy
+  handle_content_type(:destroy, content_type, :success)
 end
 
-def on_failing_destroy
+def handle_failed_destroy
   raise Merb::ControllerExceptions::InternalServerError
 end
 
+
+def html_response_on_successful_destroy
+  options = flash_messages_for?(:destroy) ? { :message =&gt; successful_destroy_messages } : {}
+  redirect redirect_on_successful_destroy, options 
+end
+        
+def xml_response_on_successful_destroy
+  &quot;&quot; # render no content, just 200 (OK) status.
+end
+     
+def json_response_on_successful_destroy
+  &quot;&quot; # render no content, just 200 (OK) status.
+end
+
+
 def redirect_on_successful_destroy
   if singleton_controller?
     has_parent? ? resource(parent) : '/'
@@ -370,6 +452,5 @@ behaves under the given circumstances.
 h2. TODO
 
 # Infer route nesting strategy from @Merb::Router@
-# Customizable support for @provides@ and @only_provides@
 # Support for user stamps (aka created_by and updated_by)
 # Support for pagination once an _official_ merb pagination solution exists
\ No newline at end of file</diff>
      <filename>README.textile</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,7 @@ require 'merb-core/tasks/merb'
 require &quot;spec/rake/spectask&quot;
 
 GEM_NAME = &quot;merb_resource_controller&quot;
-GEM_VERSION = &quot;0.1.0&quot;
+GEM_VERSION = &quot;0.2.0&quot;
 AUTHOR = &quot;Martin Gamsjaeger&quot;
 EMAIL = &quot;gamsnjaga@gmail.com&quot;
 HOMEPAGE = &quot;http://merbivore.com/&quot;</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,5 @@ TODO
 ====
 
 # Infer route nesting strategy from @Merb::Router@
-# Customizable support for @provides@ and @only_provides@
 # Support for user stamps (aka created_by and updated_by)
 # Support for pagination once an _official_ merb pagination solution exists
\ No newline at end of file</diff>
      <filename>TODO</filename>
    </modified>
    <modified>
      <diff>@@ -11,9 +11,10 @@ if defined?(Merb::Plugins)
   Merb::BootLoader.before_app_loads do
     # require code that must be loaded before the application
     mrc = File.join(File.dirname(__FILE__), 'merb_resource_controller')
-    require mrc / 'resource_proxy'
     require mrc / 'actions'
+    require mrc / 'action_descriptor'
     require mrc / 'resource_controller'
+    require mrc / 'resource_proxy'
     if Merb::Plugins.config[:merb_resource_controller][:identity_map]
       require mrc / 'identity_map_support'
     end</diff>
      <filename>lib/merb_resource_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,6 +11,7 @@ module Merb
         # end
         
         def index
+          set_action_specific_provides(:index)
           load_resource
           display requested_resource
         end
@@ -26,6 +27,7 @@ module Merb
         # end
         
         def show
+          set_action_specific_provides(:show)
           load_resource
           raise Merb::ControllerExceptions::NotFound unless requested_resource
           display requested_resource
@@ -42,7 +44,7 @@ module Merb
         # end
         
         def new
-          only_provides :html
+          set_action_specific_provides(:new)
           load_resource
           set_member(new_member)
           display member
@@ -60,7 +62,7 @@ module Merb
         # end
         
         def edit
-          only_provides :html
+          set_action_specific_provides(:edit)
           load_resource
           raise Merb::ControllerExceptions::NotFound unless requested_resource
           display requested_resource
@@ -81,27 +83,56 @@ module Merb
         # end
         
         def create
+          set_action_specific_provides(:create)
           load_resource
           set_member(new_member)
           if member.save
-            on_successful_create
+            handle_successful_create
           else
-            on_failing_create
+            handle_failed_create
           end
         end
         
         protected
+                
+        def handle_successful_create
+          handle_content_type(:create, content_type, :success)
+        end
+        
+        def handle_failed_create
+          handle_content_type(:create, content_type, :failure)
+        end
+        
         
-        def on_successful_create
+        def html_response_on_successful_create
           options = flash_messages_for?(:create) ? { :message =&gt; successful_create_messages } : {}
           redirect redirect_on_successful_create, options          
         end
-        
-        def on_failing_create
+                
+        def html_response_on_failed_create
           message.merge!(failed_create_messages) if flash_messages_for?(:create)
-          render :new, :status =&gt; 406
+          render :new, :status =&gt; 406         
+        end
+        
+                
+        def xml_response_on_successful_create
+          display member, :status =&gt; 201, :location =&gt; resource(member)
+        end
+                
+        def xml_response_on_failed_create
+          display member.errors, :status =&gt; 422
+        end        
+        
+             
+        def json_response_on_successful_create
+          display member, :status =&gt; 201, :location =&gt; resource(member)         
+        end
+                
+        def json_response_on_failed_create
+          display member.errors, :status =&gt; 422
         end
         
+        
         def redirect_on_successful_create
           target = singleton_controller? ? member_name : member
           resource(*(has_parent? ? parents + [ target ] : [ target ]))
@@ -136,27 +167,55 @@ module Merb
         # end
         
         def update
+          set_action_specific_provides(:update)
           load_resource
           raise Merb::ControllerExceptions::NotFound unless requested_resource
           if requested_resource.update_attributes(params[member_name])
-            on_successful_update
+            handle_successful_update
           else
-            on_failing_update
+            handle_failed_update
           end
         end
         
         protected
         
-        def on_successful_update
-          options = flash_messages_for?(:update) ? { :message =&gt; successful_update_messages } : {}
-          redirect redirect_on_successful_update, options
+        def handle_successful_update
+          handle_content_type(:update, content_type, :success)
         end
         
-        def on_failing_update
+        def handle_failed_update
+          handle_content_type(:update, content_type, :failure)
+        end
+        
+        
+        def html_response_on_successful_update
+          options = flash_messages_for?(:update) ? { :message =&gt; successful_update_messages } : {}
+          redirect redirect_on_successful_update, options       
+        end
+                
+        def html_response_on_failed_update
           message.merge!(failed_update_messages) if flash_messages_for?(:update)
           display requested_resource, :edit, :status =&gt; 406
         end
         
+                
+        def xml_response_on_successful_update
+          &quot;&quot; # render no content, just 200 (OK) status.
+        end
+                
+        def xml_response_on_failed_update
+          display member.errors, :status =&gt; 422
+        end        
+        
+             
+        def json_response_on_successful_update
+          &quot;&quot; # render no content, just 200 (OK) status.
+        end
+                
+        def json_response_on_failed_update
+          display member.errors, :status =&gt; 422
+        end
+        
         def redirect_on_successful_update
           target = singleton_controller? ? member_name : member
           resource(*(has_parent? ? parents + [ target ] : [ target ]))
@@ -191,26 +250,41 @@ module Merb
         # end
         
         def destroy
+          set_action_specific_provides(:destroy)
           load_resource
           raise Merb::ControllerExceptions::NotFound unless requested_resource
           if requested_resource.destroy
-            on_successful_destroy
+            handle_successful_destroy
           else
-            on_failing_destroy
+            handle_failed_destroy
           end
         end
         
         protected
         
-        def on_successful_destroy
-          options = flash_messages_for?(:destroy) ? { :message =&gt; successful_destroy_messages } : {}
-          redirect redirect_on_successful_destroy, options
+        def handle_successful_destroy
+          handle_content_type(:destroy, content_type, :success)
         end
         
-        def on_failing_destroy
+        def handle_failed_destroy
           raise Merb::ControllerExceptions::InternalServerError
         end
         
+        
+        def html_response_on_successful_destroy
+          options = flash_messages_for?(:destroy) ? { :message =&gt; successful_destroy_messages } : {}
+          redirect redirect_on_successful_destroy, options 
+        end
+                
+        def xml_response_on_successful_destroy
+          &quot;&quot; # render no content, just 200 (OK) status.
+        end
+             
+        def json_response_on_successful_destroy
+          &quot;&quot; # render no content, just 200 (OK) status.
+        end
+        
+        
         def redirect_on_successful_destroy
           if singleton_controller?
             has_parent? ? resource(parent) : '/'</diff>
      <filename>lib/merb_resource_controller/actions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,21 +10,16 @@ module Merb
       module ClassMethods
         
         def controlling(name, options = {})
-          @resource_proxy = Merb::ResourceController::ResourceProxy.new(name, options)
+          @resource_proxy = ResourceProxy.new(name, class_provided_formats, options)
           yield @resource_proxy if block_given?
           class_inheritable_reader :resource_proxy
           include InstanceMethods
-          @resource_proxy.registered_actions.each do |action|
-            action_support = action_module(action[:name])
-            include action_support
-            include action_support.const_get(&quot;FlashSupport&quot;) if action[:flash]
-            show_action(action[:name])
+          @resource_proxy.registered_actions.each do |action_descriptor|
+            include action_descriptor.action_module
+            include action_descriptor.flash_module if action_descriptor.supports_flash_messages?
+            show_action(action_descriptor.action_name)
           end
         end
-        
-        def action_module(action)
-          Merb::ResourceController::Actions.const_get(Extlib::Inflection.classify(action))
-        end
     
       end
   
@@ -37,6 +32,26 @@ module Merb
         end
         
         
+        def handle_content_type(action, format, scenario)
+          if handler = content_type_handler(action, format, scenario)
+            self.send(handler) if self.respond_to?(handler)
+          else
+            raise &quot;no content type handler registered for #{action} #{format} #{scenario}&quot;
+          end
+        end
+        
+        def content_type_handler(action, format, scenario)
+          resource_proxy.content_type_handler(action, format, scenario)
+        end
+        
+        def set_action_specific_provides(action)
+          if resource_proxy.has_format_restriction?(action)
+            provides_api, formats = resource_proxy.action_specific_provides(action)
+            self.send(provides_api, *formats)
+          end
+        end
+        
+        
         def singleton_controller?
           resource_proxy.singleton_resource?
         end
@@ -67,8 +82,7 @@ module Merb
         
         
         def load_resource
-          path = resource_proxy.path_to_resource(params)
-          path.each do |pc|
+          resource_proxy.path_to_resource(params).each do |pc|
             instance_variable_set(&quot;@#{pc[0]}&quot;, pc[1]) if pc[1]
           end
         end
@@ -119,8 +133,7 @@ module Merb
         
         
         def flash_messages_for?(action)
-          return false unless action_support = self.class.action_module(action)
-          self.kind_of?(action_support.const_get(&quot;FlashSupport&quot;))
+          resource_proxy.flash_messages_for?(action)
         end
     
       end</diff>
      <filename>lib/merb_resource_controller/resource_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,11 +13,12 @@ module Merb
         :use =&gt; :all
       })
       
-      attr_reader :resource, :parents, :registered_methods
+      attr_reader :resource, :provided_formats, :parents, :registered_methods
       
-      def initialize(resource, options = {})
+      def initialize(resource, provided_formats, options = {})
         options = DEFAULT_OPTIONS.merge(options)
         @resource, @singleton = load_resource(resource), !!options[:singleton]
+        @provided_formats = provided_formats || [ :html ]
         @fully_qualified = !!options[:fully_qualified]
         @actions, @registered_methods, @parents = [], [], []
         @specific_methods_registered = options[:use] != :all
@@ -26,7 +27,10 @@ module Merb
       end
       
       def action(name, options = {})
-        @actions &lt;&lt; { :name =&gt; name.to_sym }.merge(options)
+        options = { :default_formats =&gt; true }.merge(options)
+        descriptor = ActionDescriptor.new(name, @provided_formats, options)
+        yield descriptor if block_given?
+        @actions &lt;&lt; descriptor
       end
             
       def actions(*action_specs)
@@ -37,6 +41,40 @@ module Merb
         @actions
       end
       
+      def flash_messages_for?(action)
+        return false unless @actions.map { |ad| ad.action_name }.include?(action.to_sym)
+        @actions.any? { |ad| ad.action_name == action.to_sym &amp;&amp; ad.supports_flash_messages? }
+      end
+      
+      
+      def action_descriptor(action)
+        ad = @actions.select { |ad| ad.action_name == action.to_sym }
+        ad.first ? ad.first : raise(&quot;No action named #{action} is registered for this controller&quot;)
+      end
+      
+      def content_type_handler(action, format, scenario)
+        action_descriptor(action).content_type_handler(format, scenario)
+      end
+      
+      def has_format_restriction?(action)
+        action_descriptor(action).has_format_restriction?
+      end
+      
+      def action_specific_provides(action)
+        ad = action_descriptor(action)
+        [ ad.format_restriction_api, ad.restricted_formats ]
+      end
+      
+      def register_default_actions!
+        action :index    unless @singleton
+        action :show
+        action :new,     :only_provides =&gt; :html
+        action :edit,    :only_provides =&gt; :html
+        action :create,  :flash =&gt; true
+        action :update,  :flash =&gt; true
+        action :destroy, :flash =&gt; true
+      end
+      
       # ----------------------------------------------------------------------------------------
       # # one level nestings
       # ----------------------------------------------------------------------------------------
@@ -275,16 +313,6 @@ module Merb
         end
       end
       
-      def register_default_actions!
-        action :index unless @singleton
-        action :show
-        action :new
-        action :edit
-        action :create,  :flash =&gt; true
-        action :update,  :flash =&gt; true
-        action :destroy, :flash =&gt; true
-      end
-      
       
       # KEEP THESE for later
       </diff>
      <filename>lib/merb_resource_controller/resource_proxy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,66 +2,67 @@
 
 Gem::Specification.new do |s|
   s.name = %q{merb_resource_controller}
-  s.version = &quot;0.1.0&quot;
+  s.version = &quot;0.2.0&quot;
 
   s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 0&quot;) if s.respond_to? :required_rubygems_version=
   s.authors = [&quot;Martin Gamsjaeger&quot;]
-  s.date = %q{2008-12-10}
+  s.date = %q{2008-12-17}
   s.description = %q{A merb plugin that provides the default restful actions for controllers.}
   s.email = %q{gamsnjaga@gmail.com}
   s.extra_rdoc_files = [&quot;LICENSE&quot;, &quot;TODO&quot;]
   s.files = [
-    'LICENSE',
-    'README.textile',
-    'Rakefile',
-    'TODO',
-    'lib/merb_resource_controller/action_timeout_support.rb',
-    'lib/merb_resource_controller/actions.rb',
-    'lib/merb_resource_controller/identity_map_support.rb',
-    'lib/merb_resource_controller/resource_controller.rb',
-    'lib/merb_resource_controller/resource_proxy.rb',
-    'lib/merb_resource_controller.rb',
-    'spec/mrc_test_app',
-    'spec/mrc_test_app/Rakefile', 
-    'spec/mrc_test_app/app/controllers/application.rb',
-    'spec/mrc_test_app/app/controllers/articles.rb',
-    'spec/mrc_test_app/app/controllers/community/comments.rb',
-    'spec/mrc_test_app/app/controllers/community/ratings.rb',
-    'spec/mrc_test_app/app/controllers/editors.rb',
-    'spec/mrc_test_app/app/models/article.rb',
-    'spec/mrc_test_app/app/models/comment.rb',
-    'spec/mrc_test_app/app/models/editor.rb',
-    'spec/mrc_test_app/app/models/rating.rb',
-    'spec/mrc_test_app/config/database.yml',
-    'spec/mrc_test_app/config/environments/development.rb',
-    'spec/mrc_test_app/config/environments/rake.rb',
-    'spec/mrc_test_app/config/environments/test.rb',
-    'spec/mrc_test_app/config/init.rb',
-    'spec/mrc_test_app/config/rack.rb',
-    'spec/mrc_test_app/config/router.rb',
-    'spec/mrc_test_app/app/views/articles/edit.html.erb',
-    'spec/mrc_test_app/app/views/articles/index.html.erb',
-    'spec/mrc_test_app/app/views/articles/new.html.erb',
-    'spec/mrc_test_app/app/views/articles/show.html.erb',
-    'spec/mrc_test_app/app/views/community/comments/edit.html.erb',
-    'spec/mrc_test_app/app/views/community/comments/index.html.erb',
-    'spec/mrc_test_app/app/views/community/comments/new.html.erb',
-    'spec/mrc_test_app/app/views/community/comments/show.html.erb',
-    'spec/mrc_test_app/app/views/community/ratings/edit.html.erb',
-    'spec/mrc_test_app/app/views/community/ratings/index.html.erb',
-    'spec/mrc_test_app/app/views/community/ratings/ne.html.erb',
-    'spec/mrc_test_app/app/views/community/ratings/show.html.erb',
-    'spec/mrc_test_app/app/views/editors/edit.html.erb',
-    'spec/mrc_test_app/app/views/editors/new.html.erb',
-    'spec/mrc_test_app/app/views/editors/show.html.erb',
-    'spec/mrc_test_app/spec/lib/resource_proxy_spec.rb',
-    'spec/mrc_test_app/spec/request/article_comment_rtings_spec.rb',
-    'spec/mrc_test_app/spec/request/article_comments_spec.rb',
-    'spec/mrc_test_app/spec/request/article_editor_spec.rb',
-    'spec/mrc_test_app/spec/request/articles_spec.rb',
-    'spec/mrc_test_app/spec/request/comments_spec.rb',
-    'spec/mrc_test_app/spec/spec_helper.rb',
-    'spec/mrc_test_app/spec/spec.opts'  
+    &quot;LICENSE&quot;,
+    &quot;README.textile&quot;,
+    &quot;Rakefile&quot;,
+    &quot;TODO&quot;,
+    &quot;lib/merb_resource_controller/action_descriptor.rb&quot;,
+    &quot;lib/merb_resource_controller/action_timeout_support.rb&quot;,
+    &quot;lib/merb_resource_controller/actions.rb&quot;,
+    &quot;lib/merb_resource_controller/identity_map_support.rb&quot;,
+    &quot;lib/merb_resource_controller/resource_controller.rb&quot;,
+    &quot;lib/merb_resource_controller/resource_proxy.rb&quot;,
+    &quot;lib/merb_resource_controller.rb&quot;,
+    &quot;spec/mrc_test_app/app/controllers/application.rb&quot;,
+    &quot;spec/mrc_test_app/app/controllers/articles.rb&quot;,
+    &quot;spec/mrc_test_app/app/controllers/community/comments.rb&quot;,
+    &quot;spec/mrc_test_app/app/controllers/community/ratings.rb&quot;,
+    &quot;spec/mrc_test_app/ap/controllers/editors.rb&quot;,
+    &quot;spec/mrc_test_app/app/models/article.rb&quot;,
+    &quot;spec/mrc_test_app/app/models/community/comment.rb&quot;,
+    &quot;spec/mrc_test_app/app/models/community/rating.rb&quot;,
+    &quot;spec/mrc_test_app/app/models/editor.rb&quot;,
+    &quot;spec/mrc_test_app/config/environments/development.rb&quot;,
+    &quot;spec/mrc_test_app/config/environments/rake.rb&quot;,
+    &quot;spec/mrc_test_app/config/environments/test.rb&quot;,
+    &quot;spec/mrc_test_app/config/init.rb&quot;,
+    &quot;spec/mrc_test_app/config/rack.rb&quot;,
+    &quot;spec/mrc_test_app/config/router.rb&quot;,
+    &quot;spec/mrc_test_app/spec/lib/action_descriptor_spec.rb&quot;,
+    &quot;spec/mrc_test_app/spec/lib/resource_proxy_spec.rb&quot;,
+    &quot;spec/mrc_test_app/spec/request/article_comment_ratings_spec.rb&quot;,
+    &quot;spec/mrc_test_app/spec/request/article_comments_spec.rb&quot;,
+    &quot;spec/mrc_test_app/spec/request/article_editor_spec.rb&quot;,
+    &quot;spec/mrc_test_app/spec/request/articles_spec.rb&quot;,
+    &quot;spec/mrc_test_app/spec/request/comments_spec.rb&quot;,
+    &quot;spec/mrc_test_app/spec/spec_helper.rb&quot;,
+    &quot;spec/mrc_test_app&quot;,
+    &quot;spec/mrc_test_app/config/database.yml&quot;,
+    &quot;spec/mrc_test_app/spec/spec.opts&quot;,
+    &quot;spec/mrc_test_app/app/views/articles/edit.html.erb&quot;,
+    &quot;spec/mrc_test_app/app/views/articles/index.html.erb&quot;,
+    &quot;spec/mrc_test_app/app/views/articles/new.html.erb&quot;,
+    &quot;spec/mrc_test_app/app/views/articles/show.html.erb&quot;,
+    &quot;spec/mrc_test_app/app/views/community/comments/edit.html.erb&quot;,
+    &quot;spec/mrc_test_app/app/views/community/comments/index.html.erb&quot;,
+    &quot;spec/mrc_test_app/app/views/community/comments/new.html.erb&quot;,
+    &quot;spec/mrc_test_app/app/views/community/comments/show.html.erb&quot;,
+    &quot;spec/mrc_test_app/app/views/community/ratings/eit.html.erb&quot;,
+    &quot;spec/mrc_test_app/app/views/community/ratings/index.html.erb&quot;,
+    &quot;spec/mrc_test_app/app/views/community/ratings/new.html.erb&quot;,
+    &quot;spec/mrc_test_app/app/views/community/ratings/show.html.erb&quot;,
+    &quot;spec/mrc_test_app/app/views/editors/edit.html.erb&quot;,
+    &quot;spec/mrc_test_app/app/views/editors/new.html.erb&quot;,
+    &quot;spec/mrc_test_app/app/views/editors/show.html.erb&quot;
   ]
   s.homepage = %q{http://merbivore.com/}
   s.require_paths = [&quot;lib&quot;]</diff>
      <filename>merb_resource_controller.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,4 @@
 class Articles &lt; Application
+  provides :xml, :json
   controlling :articles
 end
\ No newline at end of file</diff>
      <filename>spec/mrc_test_app/app/controllers/articles.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,6 @@ dependency &quot;dm-constraints&quot;, dm_gems_version
 dependency &quot;merb-assets&quot;,    merb_gems_version
 dependency &quot;merb-helpers&quot;,   merb_gems_version
 
-
 use_orm :datamapper
 use_test :rspec
 use_template_engine :erb</diff>
      <filename>spec/mrc_test_app/config/init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -31,7 +31,7 @@ describe &quot;Merb::ResourceController::ResourceProxy&quot; do
   describe &quot;with default options&quot; do
     
     before(:each) do
-      options = { :defaults =&gt; true, :flash =&gt; true, :use =&gt; :all }
+      options = { :defaults =&gt; true, :use =&gt; :all }
       @p = Merb::ResourceController::ResourceProxy.new(:articles, options)
     end
     
@@ -53,7 +53,7 @@ describe &quot;Merb::ResourceController::ResourceProxy&quot; do
     
     it &quot;should have the default actions registered&quot; do
       default_actions = [ :index, :show, :new, :edit, :create, :update, :destroy ]
-      actions = @p.registered_actions.map { |h| h[:name] }
+      actions = @p.registered_actions.map { |ad| ad.action_name }
       
       actions.size.should == default_actions.size
       actions.all? { |a| default_actions.include?(a) }.should be_true
@@ -77,14 +77,14 @@ describe &quot;Merb::ResourceController::ResourceProxy&quot; do
   describe &quot;with invalid (parent) resource&quot; do
 
     it &quot;should raise NameError when initialized with an invalid resource&quot; do
-      options = { :defaults =&gt; true, :flash =&gt; true, :use =&gt; :all }
+      options = { :defaults =&gt; true, :use =&gt; :all }
       lambda {
         Merb::ResourceController::ResourceProxy.new(:foo, options)
       }.should raise_error(NameError)
     end
     
     it &quot;should raise NameError when it should belong to an invalid parent resource&quot; do
-      options = { :defaults =&gt; true, :flash =&gt; true, :use =&gt; :all }
+      options = { :defaults =&gt; true, :use =&gt; :all }
       lambda {
         p = Merb::ResourceController::ResourceProxy.new(&quot;Community::Comment&quot;, options)
         p.belongs_to :foo
@@ -97,7 +97,7 @@ describe &quot;Merb::ResourceController::ResourceProxy&quot; do
   describe &quot;with no parent resource&quot; do
     
     before(:each) do
-      options = { :defaults =&gt; true, :flash =&gt; true, :use =&gt; :all }
+      options = { :defaults =&gt; true, :use =&gt; :all }
       @p = Merb::ResourceController::ResourceProxy.new(:articles, options)
     end
     
@@ -146,7 +146,7 @@ describe &quot;Merb::ResourceController::ResourceProxy&quot; do
   describe &quot;with a single parent resource&quot; do
     
     before(:each) do
-      options = { :defaults =&gt; true, :flash =&gt; true, :use =&gt; :all }
+      options = { :defaults =&gt; true, :use =&gt; :all }
       @p = Merb::ResourceController::ResourceProxy.new(&quot;Community::Comment&quot;, options)
       @p.belongs_to :article
     end
@@ -208,7 +208,7 @@ describe &quot;Merb::ResourceController::ResourceProxy&quot; do
   describe &quot;with multiple parent resources with default keys&quot; do
     
     before(:each) do
-      options = { :defaults =&gt; true, :flash =&gt; true, :use =&gt; :all }
+      options = { :defaults =&gt; true, :use =&gt; :all }
       @p = Merb::ResourceController::ResourceProxy.new(&quot;Community::Rating&quot;, options)
       @p.belongs_to [ :article, &quot;Community::Comment&quot; ]
     end</diff>
      <filename>spec/mrc_test_app/spec/lib/resource_proxy_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -134,6 +134,108 @@ describe &quot;POST resource(:articles)&quot; do
   
 end
 
+describe &quot;XML POST resource(:articles)&quot; do
+  
+  describe &quot;Success&quot; do
+  
+    before(:each) do
+      Article.all.destroy!
+      @response = request(resource(:articles),
+        :method =&gt; &quot;POST&quot;,
+        :params =&gt; { :article =&gt; { :id =&gt; nil, :title =&gt; &quot;Hey there&quot;, :body =&gt; &quot;Me like snusnu&quot; }},
+        &quot;HTTP_ACCEPT&quot; =&gt; &quot;application/xml&quot;
+        )
+    end
+  
+    it &quot;should return a 201 (Created) status&quot; do
+      @response.status.should == 201
+      @response.body.length.should_not == 0
+    end
+    
+  end
+  
+  describe &quot;Failure&quot; do
+
+    before(:each) do
+      Article.all.destroy!
+      @response = request(
+        resource(:articles), 
+        :method =&gt; &quot;POST&quot;, 
+        :params =&gt; { 
+          :article =&gt; { 
+            :id =&gt; nil,
+            :title =&gt; nil,
+            :body =&gt; &quot;article body&quot; 
+          }
+        },
+        &quot;HTTP_ACCEPT&quot; =&gt; &quot;application/xml&quot;
+      )
+    end
+
+    it &quot;should not be successful&quot; do
+      @response.should_not be_successful
+      @response.status.should == 422
+    end
+
+    it &quot;should return the serialized errors that occured&quot; do
+      @response.body.size.should &gt;= 0
+    end
+
+  end
+  
+end
+
+describe &quot;XML POST resource(:articles)&quot; do
+  
+  describe &quot;Success&quot; do
+  
+    before(:each) do
+      Article.all.destroy!
+      @response = request(resource(:articles),
+        :method =&gt; &quot;POST&quot;,
+        :params =&gt; { :article =&gt; { :id =&gt; nil, :title =&gt; &quot;Hey there&quot;, :body =&gt; &quot;Me like snusnu&quot; }},
+        &quot;HTTP_ACCEPT&quot; =&gt; &quot;application/json&quot;
+        )
+    end
+  
+    it &quot;should return a 201 (Created) status&quot; do
+      @response.status.should == 201
+      @response.body.length.should_not == 0
+    end
+    
+  end
+  
+  describe &quot;Failure&quot; do
+
+    before(:each) do
+      Article.all.destroy!
+      @response = request(
+        resource(:articles), 
+        :method =&gt; &quot;POST&quot;, 
+        :params =&gt; { 
+          :article =&gt; { 
+            :id =&gt; nil,
+            :title =&gt; nil,
+            :body =&gt; &quot;article body&quot; 
+          }
+        },
+        &quot;HTTP_ACCEPT&quot; =&gt; &quot;application/json&quot;
+      )
+    end
+
+    it &quot;should not be successful&quot; do
+      @response.should_not be_successful
+      @response.status.should == 422
+    end
+
+    it &quot;should return the serialized errors that occured&quot; do
+      @response.body.size.should &gt;= 0
+    end
+
+  end
+  
+end
+
 describe &quot;PUT resource(@article)&quot;, :given =&gt; &quot;an Article exists&quot; do
   
   describe &quot;Success&quot; do
@@ -177,6 +279,96 @@ describe &quot;PUT resource(@article)&quot;, :given =&gt; &quot;an Article exists&quot; do
   
 end
 
+describe &quot;XML PUT resource(@article)&quot;, :given =&gt; &quot;an Article exists&quot; do
+  
+  describe &quot;Success&quot; do
+    
+    before(:each) do
+      @article = Article.first
+      @response = request(resource(@article),
+        :method =&gt; &quot;PUT&quot;,
+        :params =&gt; { :article =&gt; { :id =&gt; @article.id } },
+        &quot;HTTP_ACCEPT&quot; =&gt; &quot;application/xml&quot;)
+    end
+    
+    it &quot;should return an empty response with a 200 (OK) status&quot; do
+      @response.status.should == 200
+      @response.body.length.should == 0
+    end
+    
+  end
+  
+  
+  describe &quot;Failure&quot; do
+  
+    before(:each) do
+      @article = Article.first
+      @response = request(
+        resource(@article), 
+        :method =&gt; &quot;PUT&quot;, 
+        :params =&gt; { :article =&gt; { :id =&gt; @article.id, :title =&gt; nil, :body =&gt; &quot;updated body&quot; } },
+        &quot;HTTP_ACCEPT&quot; =&gt; &quot;application/xml&quot;
+      )
+    end
+  
+    it &quot;should not be successful&quot; do
+      @response.should_not be_successful
+      @response.status.should == 422
+    end
+    
+    it &quot;should return the serialized errors that occured&quot; do
+      @response.body.size.should &gt;= 0
+    end
+  
+  end
+  
+end
+
+describe &quot;JSON PUT resource(@article)&quot;, :given =&gt; &quot;an Article exists&quot; do
+  
+  describe &quot;Success&quot; do
+    
+    before(:each) do
+      @article = Article.first
+      @response = request(resource(@article),
+        :method =&gt; &quot;PUT&quot;,
+        :params =&gt; { :article =&gt; { :id =&gt; @article.id } },
+        &quot;HTTP_ACCEPT&quot; =&gt; &quot;application/json&quot;)
+    end
+    
+    it &quot;should return an empty response with a 200 (OK) status&quot; do
+      @response.status.should == 200
+      @response.body.length.should == 0
+    end
+    
+  end
+  
+  
+  describe &quot;Failure&quot; do
+  
+    before(:each) do
+      @article = Article.first
+      @response = request(
+        resource(@article), 
+        :method =&gt; &quot;PUT&quot;, 
+        :params =&gt; { :article =&gt; { :id =&gt; @article.id, :title =&gt; nil, :body =&gt; &quot;updated body&quot; } },
+        &quot;HTTP_ACCEPT&quot; =&gt; &quot;application/json&quot;
+      )
+    end
+  
+    it &quot;should not be successful&quot; do
+      @response.should_not be_successful
+      @response.status.should == 422
+    end
+    
+    it &quot;should render the serialized errors that occured&quot; do
+      @response.body.size.should &gt;= 0
+    end
+  
+  end
+  
+end
+
 describe &quot;DELETE resource(@article)&quot; do
   
   describe &quot;Success&quot;, :given =&gt; &quot;an Article exists&quot; do
@@ -206,3 +398,77 @@ describe &quot;DELETE resource(@article)&quot; do
   end
   
 end
+
+describe &quot;XML DELETE resource(@article)&quot; do
+  
+  describe &quot;Success&quot;, :given =&gt; &quot;an Article exists&quot; do
+    
+    before(:each) do
+      @response = request(resource(Article.first),
+        :method =&gt; &quot;DELETE&quot;,
+        &quot;HTTP_ACCEPT&quot; =&gt; &quot;application/xml&quot;
+      )
+    end
+    
+    it &quot;should return an empty response with a 200 (OK) status&quot; do
+      @response.status.should == 200
+      @response.body.length.should == 0
+    end
+ 
+  end
+  
+  describe &quot;Failure&quot; do
+    
+    before(:each) do
+      Article.all.destroy!
+      @response = request('/articles/1', 
+        :method =&gt; &quot;DELETE&quot;,
+        &quot;HTTP_ACCEPT&quot; =&gt; &quot;application/xml&quot;
+      )
+    end
+
+    it &quot;should not be successful&quot; do
+      @response.should_not be_successful
+      @response.status.should == 404
+    end
+
+  end
+  
+end
+
+describe &quot;JSON DELETE resource(@article)&quot; do
+  
+  describe &quot;Success&quot;, :given =&gt; &quot;an Article exists&quot; do
+    
+    before(:each) do
+      @response = request(resource(Article.first),
+        :method =&gt; &quot;DELETE&quot;,
+        &quot;HTTP_ACCEPT&quot; =&gt; &quot;application/json&quot;
+      )
+    end
+    
+    it &quot;should return an empty response with a 200 (OK) status&quot; do
+      @response.status.should == 200
+      @response.body.length.should == 0
+    end
+ 
+  end
+  
+  describe &quot;Failure&quot; do
+    
+    before(:each) do
+      Article.all.destroy!
+      @response = request('/articles/1', 
+        :method =&gt; &quot;DELETE&quot;,
+        &quot;HTTP_ACCEPT&quot; =&gt; &quot;application/json&quot;
+      )
+    end
+
+    it &quot;should not be successful&quot; do
+      @response.should_not be_successful
+      @response.status.should == 404
+    end
+
+  end
+  
+end</diff>
      <filename>spec/mrc_test_app/spec/request/articles_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e37740339a01e6a055563ae16a5ee21b65e1a86a</id>
    </parent>
  </parents>
  <author>
    <name>Martin Gamsjaeger</name>
    <email>gamsnjaga@gmail.com</email>
  </author>
  <url>http://github.com/snusnu/merb_resource_controller/commit/be081befe771c2ec3af343a16a9cf8f819433983</url>
  <id>be081befe771c2ec3af343a16a9cf8f819433983</id>
  <committed-date>2008-12-17T14:14:48-08:00</committed-date>
  <authored-date>2008-12-17T14:14:48-08:00</authored-date>
  <message>Allow action specific content type restrictions.

It's now possible to serve :html, :xml, :json, :yml
and :csv out of the box. Additional content types
are handled equally easily by registering their symbols
and then following simple naming conventions. The
current README kind of reflects this, but it needs
further explanation.

Along with this to work correctly for displaying
datamapper validation error collections, I filed a
patch to the datamapper lighthouse which can be found
at http://tinyurl.com/4czxm7</message>
  <tree>622c5f15f582b4dd6229db7179234c8d3667667a</tree>
  <committer>
    <name>Martin Gamsjaeger</name>
    <email>gamsnjaga@gmail.com</email>
  </committer>
</commit>
