Bug 543423

Summary: Create ancestor for rest-service models
Product: [openSUSE] openSUSE 11.2 Reporter: Josef Reidinger <jreidinger>
Component: WebYaSTAssignee: Josef Reidinger <jreidinger>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Enhancement    
Priority: P4 - Low CC: kkaempf
Version: Milestone 8   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Josef Reidinger 2009-10-01 09:25:30 UTC
Our rest-service doesn't have any validations like ActiveResource or ActiveRecord to check if values is good before send it to dbus. This should be added.
I plan to start working on this, so this should just track this issue.
Comment 1 Josef Reidinger 2009-10-13 08:58:43 UTC
As I write on mailing-list http://lists.opensuse.org/yast-devel/2009-10/msg00108.html it is quite hard to do only validation, it should be part of some backend ancestor which provide functionality.
Klaus - what do you think about it? Do model ancestor which provide same behavior as ActiveResource and ActiveRecord also for DBus? Or postpone it after feature freeze and release?
Comment 2 Klaus Kämpf 2009-10-13 09:05:52 UTC
I like the proposal but wonder if there isn't a gem/plugin already which provides what we need.
So my gut feeling is that this needs some more research and should not be rushed before feature freeze.
Comment 3 Josef Reidinger 2009-10-22 14:54:32 UTC
After looking for possibilities I extent this task.

Nowadays, module contains many non-problem related code which is repeatedly done like assigning values from xml, generating xml or validating.

Target of this task, is to provide ancestor of models for rest-service. This ancestor should be based on ActiveModel (is present in rails from 3.0, so it need pack it as gem), which provide basic functionality of ActiveResource and ActiveRecord. Above it it should contain smarted xml generated, because current one have problem with complex data structures.

After change model should contain only reading data from DBus and writing to DBus, and common rails syntax for attributes (for validation or protection).

Klaus do you agree with this improvement? (planned to work after release of first stable version)
Comment 4 Klaus Kämpf 2009-10-22 15:38:13 UTC
Yes, absolutely !

Lets discuss the details on the mailing list.
Comment 5 Josef Reidinger 2009-12-08 09:44:20 UTC
After some discuss on opensuse-ruby ( http://lists.opensuse.org/opensuse-ruby/2009-12/msg00000.html ) there is few points which ancestor should follow.

- Do not use ActiveModel as it is introduced in rails3 and still experimental
- But use ActiveModel compatible interface (http://www.engineyard.com/blog/2009/my-five-favorite-things-about-rails-3/ (part 4 - Active model - requirements))

So write own ancestor (use modules) which increase as requirements increase, use compatible interface and inspire by ActiveModel. Enclose modules to separate namespace.
Comment 6 Josef Reidinger 2009-12-15 15:00:18 UTC
merged to master. Requirements for improvements should be handled in separate bug reports.