Hello community,

here is the log from the commit of package rubygem-responders for 
openSUSE:Factory checked in at 2016-04-28 16:53:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-responders (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-responders.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-responders"

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-responders/rubygem-responders.changes    
2015-02-16 21:13:40.000000000 +0100
+++ 
/work/SRC/openSUSE:Factory/.rubygem-responders.new/rubygem-responders.changes   
    2016-04-28 16:56:39.000000000 +0200
@@ -1,0 +2,21 @@
+Tue Mar 22 05:33:48 UTC 2016 - co...@suse.com
+
+- updated to version 2.1.2
+ see installed CHANGELOG.md
+
+  ## 2.1.2
+  
+  * Fix rendering when using `ActionController::API`. (by @eLod)
+  * Added API controller template for the controller generator. (by @vestimir)
+
+-------------------------------------------------------------------
+Sun Dec 20 05:36:45 UTC 2015 - co...@suse.com
+
+- updated to version 2.1.1
+ see installed CHANGELOG.md
+
+  ## 2.1.1
+  
+  * Added support for Rails 5.
+
+-------------------------------------------------------------------

Old:
----
  responders-2.1.0.gem

New:
----
  responders-2.1.2.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-responders.spec ++++++
--- /var/tmp/diff_new_pack.JhB79k/_old  2016-04-28 16:56:40.000000000 +0200
+++ /var/tmp/diff_new_pack.JhB79k/_new  2016-04-28 16:56:40.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-responders
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-responders
-Version:        2.1.0
+Version:        2.1.2
 Release:        0
 %define mod_name responders
 %define mod_full_name %{mod_name}-%{version}

++++++ responders-2.1.0.gem -> responders-2.1.2.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2015-01-27 10:28:18.000000000 +0100
+++ new/CHANGELOG.md    2016-03-21 15:20:44.000000000 +0100
@@ -1,3 +1,12 @@
+## 2.1.2
+
+* Fix rendering when using `ActionController::API`. (by @eLod)
+* Added API controller template for the controller generator. (by @vestimir)
+
+## 2.1.1
+
+* Added support for Rails 5.
+
 ## 2.1.0
 
 * No longer automatically set the responders generator as many projects may 
use this gem as a dependency. When upgrading, users will need to add 
`config.app_generators.scaffold_controller :responders_controller` to their 
application. The `responders:install` generator has been updated to 
automatically insert it in new applications
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MIT-LICENSE new/MIT-LICENSE
--- old/MIT-LICENSE     2015-01-27 10:28:18.000000000 +0100
+++ new/MIT-LICENSE     2016-03-21 15:20:44.000000000 +0100
@@ -1,4 +1,4 @@
-Copyright 2009-2014 Plataforma Tecnologia. http://blog.plataformatec.com.br
+Copyright 2009-2016 Plataformatec. http://plataformatec.com.br
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2015-01-27 10:28:18.000000000 +0100
+++ new/README.md       2016-03-21 15:20:44.000000000 +0100
@@ -1,8 +1,8 @@
 # Responders
 
-[![Gem 
Version](https://fury-badge.herokuapp.com/rb/responders.png)](http://badge.fury.io/rb/responders)
-[![Build 
Status](https://api.travis-ci.org/plataformatec/responders.png?branch=master)](http://travis-ci.org/plataformatec/responders)
-[![Code 
Climate](https://codeclimate.com/github/plataformatec/responders.png)](https://codeclimate.com/github/plataformatec/responders)
+[![Gem 
Version](https://fury-badge.herokuapp.com/rb/responders.svg)](http://badge.fury.io/rb/responders)
+[![Build 
Status](https://api.travis-ci.org/plataformatec/responders.svg?branch=master)](http://travis-ci.org/plataformatec/responders)
+[![Code 
Climate](https://codeclimate.com/github/plataformatec/responders.svg)](https://codeclimate.com/github/plataformatec/responders)
 
 A set of responders modules to dry up your Rails 4.2+ app.
 
@@ -17,6 +17,10 @@
     $ bundle install
     $ rails g responders:install
 
+If you are including this gem to support backwards compatibilty for responders 
in previous releases of Rails, you only need to include the gem and bundle. 
+
+    $ bundle install
+
 ## Responders Types
 
 ### FlashResponder
@@ -101,6 +105,22 @@
 end
 ```
 
+**Dealing with namespaced routes**
+
+In order for the LocationResponder to find the correct route helper for 
namespaced routes you need to pass the namespaces to `respond_with`:
+
+```ruby
+class Api::V1::ThingsController < ApplicationController
+  respond_to :json
+
+  # POST /api/v1/things
+  def create
+    @thing = Thing.create(thing_params)
+    respond_with :api, :v1, @thing
+  end
+end
+```
+
 ## Configuring your own responder
 
 Responders only provides a set of modules and to use them you have to create 
your own
@@ -109,7 +129,7 @@
 
 ```ruby
 # lib/application_responder.rb
-class AppResponder < ActionController::Responder
+class ApplicationResponder < ActionController::Responder
   include Responders::FlashResponder
   include Responders::HttpCacheResponder
 end
@@ -122,7 +142,7 @@
 require "application_responder"
 
 class ApplicationController < ActionController::Base
-  self.responder = AppResponder
+  self.responder = ApplicationResponder
   respond_to :html
 end
 ```
@@ -168,13 +188,41 @@
 
     config.app_generators.scaffold_controller :responders_controller
 
+#Failure handling
+
+Responders don't use `valid?` to check for errors in models to figure out if
+the request was successfull or not, and relies on your controllers to call
+`save` or `create` to trigger the validations.
+
+```ruby
+def create
+  @widget = Widget.new(widget_params)
+  # @widget will be a valid record for responders, as we haven't called `save`
+  # on it, and will always redirect to the `widgets_path`.
+  respond_with @widget, location: -> { widgets_path }
+end
+```
+
+Responders will check if the `errors` object in your model is empty or not. 
Take
+this in consideration when implementing different actions or writing test
+assertions on this behavior for your controllers.
+
+```ruby
+def create
+  @widget = Widget.new(widget_params)
+  @widget.errors.add(:base, :invalid)
+  # `respond_with` will render the `new` template again.
+  respond_with @widget
+end
+```
+
 ## Examples
 
 Want more examples ? Check out this blog posts:
 
 * [Embracing REST with mind, body and 
soul](http://blog.plataformatec.com.br/2009/08/embracing-rest-with-mind-body-and-soul/)
 * [Three reasons to love 
ActionController::Responder](http://weblog.rubyonrails.org/2009/8/31/three-reasons-love-responder/)
-* [My five favorite things about Rails 
3](http://www.engineyard.com/blog/2009/my-five-favorite-things-about-rails-3/)
+* [My five favorite things about Rails 
3](http://www.engineyard.com/blog/2009/my-five-favorite-things-about-rails-3)
 
 ## Bugs and Feedback
 
@@ -182,4 +230,4 @@
 
 http://github.com/plataformatec/responders/issues
 
-MIT License. Copyright 2009-2014 Plataforma Tecnologia. 
http://blog.plataformatec.com.br
+MIT License. Copyright 2009-2016 Plataformatec. http://plataformatec.com.br
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/action_controller/respond_with.rb 
new/lib/action_controller/respond_with.rb
--- old/lib/action_controller/respond_with.rb   2015-01-27 10:28:18.000000000 
+0100
+++ new/lib/action_controller/respond_with.rb   2016-03-21 15:20:44.000000000 
+0100
@@ -175,7 +175,9 @@
     # Also, a hash passed to +respond_with+ immediately after the specified
     # resource(s) is interpreted as a set of options relevant to all
     # formats. Any option accepted by +render+ can be used, e.g.
+    #
     #   respond_with @people, status: 200
+    #
     # However, note that these options are ignored after an unsuccessful 
attempt
     # to save a resource, e.g. when automatically rendering <tt>:new</tt>
     # after a post request.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/action_controller/responder.rb 
new/lib/action_controller/responder.rb
--- old/lib/action_controller/responder.rb      2015-01-27 10:28:18.000000000 
+0100
+++ new/lib/action_controller/responder.rb      2016-03-21 15:20:44.000000000 
+0100
@@ -182,10 +182,12 @@
     # responds to :to_format and display it.
     #
     def to_format
-      if get? || !has_errors? || response_overridden?
+      if !get? && has_errors? && !response_overridden?
+        display_errors
+      elsif has_view_rendering? || response_overridden?
         default_render
       else
-        display_errors
+        api_behavior
       end
     rescue ActionView::MissingTemplate
       api_behavior
@@ -233,7 +235,7 @@
       if @default_response
         @default_response.call(options)
       else
-        controller.default_render(options)
+        controller.render(options)
       end
     end
 
@@ -273,6 +275,10 @@
       Renderers::RENDERERS.include?(format)
     end
 
+    def has_view_rendering?
+      controller.class.include? ActionView::Rendering
+    end
+
     # By default, render the <code>:edit</code> action for HTML requests with 
errors, unless
     # the verb was POST.
     #
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/generators/rails/templates/api_controller.rb 
new/lib/generators/rails/templates/api_controller.rb
--- old/lib/generators/rails/templates/api_controller.rb        1970-01-01 
01:00:00.000000000 +0100
+++ new/lib/generators/rails/templates/api_controller.rb        2016-03-21 
15:20:44.000000000 +0100
@@ -0,0 +1,51 @@
+<% if namespaced? -%>
+require_dependency "<%= namespaced_file_path %>/application_controller"
+
+<% end -%>
+<% module_namespacing do -%>
+class <%= controller_class_name %>Controller < ApplicationController
+  before_action :set_<%= singular_table_name %>, only: [:show, :update, 
:destroy]
+
+  respond_to :json
+
+<% unless options[:singleton] -%>
+  def index
+    @<%= plural_table_name %> = <%= orm_class.all(class_name) %>
+    respond_with(@<%= plural_table_name %>)
+  end
+<% end -%>
+
+  def show
+    respond_with(@<%= singular_table_name %>)
+  end
+
+  def create
+    @<%= singular_table_name %> = <%= orm_class.build(class_name, 
attributes_params) %>
+    <%= "flash[:notice] = '#{class_name} was successfully created.' if " if 
flash? %>@<%= orm_instance.save %>
+    respond_with(@<%= singular_table_name %>)
+  end
+
+  def update
+    <%= "flash[:notice] = '#{class_name} was successfully updated.' if " if 
flash? %>@<%= orm_instance.update(attributes_params) %>
+    respond_with(@<%= singular_table_name %>)
+  end
+
+  def destroy
+    @<%= orm_instance.destroy %>
+    respond_with(@<%= singular_table_name %>)
+  end
+
+  private
+    def set_<%= singular_table_name %>
+      @<%= singular_table_name %> = <%= orm_class.find(class_name, 
"params[:id]") %>
+    end
+
+    def <%= "#{singular_table_name}_params" %>
+      <%- if attributes_names.empty? -%>
+      params[:<%= singular_table_name %>]
+      <%- else -%>
+      params.require(:<%= singular_table_name %>).permit(<%= 
attributes_names.map { |name| ":#{name}" }.join(', ') %>)
+      <%- end -%>
+    end
+end
+<% end -%>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/responders/controller_method.rb 
new/lib/responders/controller_method.rb
--- old/lib/responders/controller_method.rb     2015-01-27 10:28:18.000000000 
+0100
+++ new/lib/responders/controller_method.rb     2016-03-21 15:20:44.000000000 
+0100
@@ -34,4 +34,6 @@
   end
 end
 
-ActionController::Base.extend Responders::ControllerMethod
+ActiveSupport.on_load(:action_controller) do
+  ActionController::Base.extend Responders::ControllerMethod
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/responders/version.rb 
new/lib/responders/version.rb
--- old/lib/responders/version.rb       2015-01-27 10:28:18.000000000 +0100
+++ new/lib/responders/version.rb       2016-03-21 15:20:44.000000000 +0100
@@ -1,3 +1,3 @@
 module Responders
-  VERSION = "2.1.0".freeze
+  VERSION = "2.1.2".freeze
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2015-01-27 10:28:18.000000000 +0100
+++ new/metadata        2016-03-21 15:20:44.000000000 +0100
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: responders
 version: !ruby/object:Gem::Version
-  version: 2.1.0
+  version: 2.1.2
 platform: ruby
 authors:
 - José Valim
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2015-01-27 00:00:00.000000000 Z
+date: 2016-03-21 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: railties
@@ -19,7 +19,7 @@
         version: 4.2.0
     - - "<"
       - !ruby/object:Gem::Version
-        version: '5'
+        version: '5.1'
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@
         version: 4.2.0
     - - "<"
       - !ruby/object:Gem::Version
-        version: '5'
+        version: '5.1'
 description: A set of Rails responders to dry up your application
 email: cont...@plataformatec.com.br
 executables: []
@@ -43,6 +43,7 @@
 - lib/action_controller/responder.rb
 - lib/generators/rails/USAGE
 - lib/generators/rails/responders_controller_generator.rb
+- lib/generators/rails/templates/api_controller.rb
 - lib/generators/rails/templates/controller.rb
 - lib/generators/responders/install_generator.rb
 - lib/responders.rb
@@ -73,7 +74,7 @@
       version: '0'
 requirements: []
 rubyforge_project: responders
-rubygems_version: 2.2.2
+rubygems_version: 2.5.1
 signing_key: 
 specification_version: 4
 summary: A set of Rails responders to dry up your application


Reply via email to