wrest icon indicating copy to clipboard operation
wrest copied to clipboard

always_has should support setting a default value

Open kaiwren opened this issue 14 years ago • 1 comments

for example class Foo always_has :tags, :default => [] end

kaiwren avatar Sep 29 '10 09:09 kaiwren

I think a small change can simplify the implementation:

class Foo
  always_has :tags => []
end

If the entry is a hash we use it's key as the attribute name and corresponding value as the default value. If it's just a symbol then we use it as only an attribute name.

ardbytes avatar Nov 11 '10 06:11 ardbytes