Mailinglist Archive: yast-devel (77 mails)

< Previous Next >
[yast-devel] Webyast: Models in webclient and some suggestion to rest-service resources
  • From: Josef Reidinger <jreidinger@xxxxxxx>
  • Date: Mon, 21 Dec 2009 16:30:38 +0100
  • Message-id: <200912211630.39070.jreidinger@xxxxxxx>
I just finish basic functionality of YastModel for webclient. I think that my
solution is better then use_activeresource branch :)

It is really intuitive to use.
It is still only in branch waiting for your comments and improvements (branch

How use it? simply :) (example is time module in branch)

create model:
class Stime < ActiveResource::Base # 1) 2)
extend YastModel::Base #3)
model_interface :'org.opensuse.yast.modules.yapi.time' #4)

1) Stime because Time already exist and we don't want to overwrite it
2) use ActiveResource not ActiveRecord (gives quite strange errors :)
3) contain definition of model_interface and needed fixtures
4) interface which you use now with load_proxy

And model usage is then same as for common ActiveResource:

@permissions = Stime.permissions #5)
time = Stime.find :one #6)
time.timezone etc...

5) It is class method because it is related to site, user and collection which
is also stored in class, so I leave it in same scope
6) :one because time is single resource

And there should be some discuss about format which provide resources.

What is policy? Resource model in rest-service really lack any documentation
Also I am not sure if we require singleton key, as type must know user at
webclient and use find :all, :first:, :last etc for multi resource and :one for
single resource.
What I found inadequate is href, which should be separated to fixed prefix and
changable collection name. Because now we have quite serius problems if we want
use namespace for controllers.

Feel free to post any question or suggestion to my solution. If martin agree
with it I plan to merge it to master (as it is separate solution).


Josef Reidinger
YaST team
maintainer of perl-Bootloader, YaST2-Repair, webyast
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages