Martin Kudlvasr write:
> ref: refs/heads/master
> commit aa80f8228d1d0d9cd349a7b0d2f054b0138e67ed
> Author: Martin Kudlvasr <[email protected]>
> Date:   Tue Sep 15 16:15:15 2009 +0200
> 
>     small fixes to restfull resource
> ---
>  webservice/app/controllers/resources_controller.rb |   14 ++++++--------
>  webservice/app/models/resource.rb                  |   10 ++++++++--
>  webservice/app/views/resources/index.html.erb      |    5 ++---
>  webservice/app/views/resources/show.html.erb       |    4 ++--
>  webservice/config/routes.rb                        |    3 ++-
>  5 files changed, 20 insertions(+), 16 deletions(-)
> 
> diff --git a/webservice/app/controllers/resources_controller.rb
>  b/webservice/app/controllers/resources_controller.rb index
>  087010a..ae90e04 100644
> --- a/webservice/app/controllers/resources_controller.rb
> +++ b/webservice/app/controllers/resources_controller.rb
> @@ -3,23 +3,21 @@ class ResourcesController < ApplicationController
> 
>    def index
>      @resources = Resource.all
> +    do_respond
> +  end
> +
> +  def do_respond
>      @node = "Yast"
> 
> -    logger.debug("Ahoj!")
> -    debugger
>      respond_to do |format|
>        format.html
>        format.xml { render :xml => @resources.to_xml }
> +      format.json{ render :json=> @resources.to_json}
>      end
>    end
> 
>    def show
>      @resources = Resource.find(params[:id])
> -    @node = "Yast"
> -
> -    respond_to do |format|
> -      format.html
> -      format.xml { render :xml => @resources.to_xml }
> -    end
> +    do_respond
>    end
>  end
> diff --git a/webservice/app/models/resource.rb
>  b/webservice/app/models/resource.rb index 8cd8b1e..417ec2b 100644
> --- a/webservice/app/models/resource.rb
> +++ b/webservice/app/models/resource.rb
> @@ -7,6 +7,8 @@ class Resource
>    attr_accessor :implementations
> 
>    class Implementation
> +    attr_accessor :controller, :interface
> +
>      def initialize(interface, impl_hash)
>        @interface = interface
>        @policy    = impl_hash[:policy]
> @@ -15,18 +17,22 @@ class Resource
>      end
> 
>      def link_to
> -      "/#...@controller}/#...@singular ? "show" : "index"}"
> +      "/#...@controller}/#{action}"

^^^
This is root of actual problems. It is not true, that route is controller. It 
is not how is routes created in lib/resource_registration. So this two values 
dismatch and all plugin that have different last identifier from interface and 
controller name is broken. (now systemtime plugin)

-- 
Josef Reidinger
YaST team
maintainer of perl-Bootloader, YaST2-Repair, webyast modules language and 
time
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to