Feature #88

Let generation work with protected attributes

Added by Yossef Mendelssohn 208 days ago. .

Status :New Start :06/12/2008
Priority :Normal Due date :
Assigned to :- % Done :

0%

Category :- Spent time : -
Target version :-

Description

The generation presently uses the initialization-with-hash method of creating instances, but that won't work with AR's attr_protected (or the inverse, attr_accessible). Since the list of protected attrs is (or should be) easily found/queried, it should be possible to assign those separately so the values still get in. Something like

obj = new(args_hash)

(protected_attrs & args_hash.keys).each do |attr|
  obj.send("#{attr}=", args_hash[attr])
end

Or hell, if we're getting to that point we may as well do the loop always instead of using new(args_hash).

Also available in: Atom PDF