Martin Kudlvasr write:
> Hi,
> 
> I've been continuing with the work, which Martin Vidner and Karel started 2
> weeks ago - trying to use ActiveResource without service_resource.rb . This
>  is currently the "use-activeresource" branch.
> 
> I've added support for discovering controller paths from interface name. So
> currently there are no hard coded controller paths.
> 
> Previously resources were used like this:
> 
> *** Example from network_controller.rb ***
> hn = load_proxy "org.opensuse.yast.modules.yapi.network.hostname"
> ***
> 
> Now they can be used like this:
> 
> *** plugins/network/app/model/hostname.rb ***
> class Hostname < YastResource
>   uses_interface "org.opensuse.yast.modules.yapi.network.hostname"
> end
> *** Example from network_controller.rb ***
> Hostname.initialize_from_interface

^^^^
Hi, why you need this line??? I think that have it in before_filter is good 
solution. What could be problem is that we should add some caching service as 
resource_loader store link for already created module.

> hn = Hostname.find :one
> ***
> 
> I think, that:
>  - this newer approach better follows the MVC philosophy (with
> service_resource.rb, no model class is possible)
>  - the YastResource < ActiveResource class is much shorter and more
>  readable - individual model classes can be enriched by resource-specific
>  methods - YastResource and individual models are not created dynamically -
>  and so are easier to test (in contrast with service_resource.rb)
>  - test can be made for the model. Currently we depend on tests in
>  controller. - it is Black Magic Free (TM) :-)
> 
> Please note, that "use-activeresource" branch depends on "resource-restful"
> branch, because it needs to discover individual resources (which is not
> possible with current "/resources" on web-service).
> 
> This work was done to show, that there are other (and many think better)
> approaches to the problem than dynamic creation of classes in
> service_resource.rb. So I especially ask Duncan and Klaas, what other
>  problems service_resource solves and YastResource does not.
> 
> Please let me know what you think.
> 
> Martin Kudlvasr
> 

-- 
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