Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always_has should support setting a default value #48

Open
kaiwren opened this issue Sep 29, 2010 · 1 comment
Open

always_has should support setting a default value #48

kaiwren opened this issue Sep 29, 2010 · 1 comment

Comments

@kaiwren
Copy link
Contributor

kaiwren commented Sep 29, 2010

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

@ardbytes
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants