Mailinglist Archive: yast-devel (163 mails)

< Previous Next >
Re: [yast-devel] use-activeresource
  • From: Klaus Kaempf <kkaempf@xxxxxxx>
  • Date: Thu, 10 Sep 2009 11:18:14 +0200
  • Message-id: <20090910091814.GA32406@xxxxxxxxxxxxx>
* Duncan Mac-Vicar Prett <dmacvicar@xxxxxxx> [Sep 10. 2009 11:03]:
On Thursday 10 September 2009 10:37:17 Klaus Kaempf wrote:
* Duncan Mac-Vicar Prett <dmacvicar@xxxxxxx> [Sep 10. 2009 10:19]:
I think Martin approach is saner and easier for Rails developers. I am
not sure how he expects to un-hardcode the remote path prefix by using
the interface, but I like the design of declaring the options in the
model class itself, in the same style of has_many and so on, one could
get something like with_interface "org.yast..." as an option to the path
derived from the class.

Can you point us to a Wiki page explaining your approach and some
example code showing the improvements over the current implementation ?

Please don't pollute the wiki with stuff that nobody will remember to cleanup
later ;-).

I find it quite important to document why a particular solution was
choosen in a persistant way. And mail is not persistent ;-)


IMO the place for an example is the final module tutorial and unless
the final approach is defined, the place for documentation is the
comments above the class in Martin's branch.
Mailing lists are fine for discussions and showing "examples".

the main difference is, current solution:

(client side)

client = YaST::ServiceReource.proxy_for('org.opensuse.yast.network.interface')
cards = client.find(:all)
...
if not client.permissions.write?
.. disable ui
end

Martin's solution

(client side)

class Interface < YastResource::Base
has_prefix '/network'
end

then in the controller:

cards = Interface.find(:all)
Interface.permissions...

Ah, thanks, now things are starting to get clearer.


And what we describe as missing features is the ability to do:

class Interface < YastResource::Base
any_that_implements 'org.opensuse.yast.network.interface'
end

instead of using has_prefix


Definitely.

Actually, there's no possibility to control the resource URI in Rails
because it is assembled from the controller name and module
(namespace). And that's why we've choosen the 'implements interface'
approach because it doesn't require any knowledge about the
implementation (controller name) of the service side.

Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N├╝rnberg)

--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups