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

Add array type for property #5

Open
nesquena opened this issue Feb 1, 2012 · 1 comment
Open

Add array type for property #5

nesquena opened this issue Feb 1, 2012 · 1 comment
Assignees

Comments

@nesquena
Copy link
Collaborator

nesquena commented Feb 1, 2012

Once we have typecasting, we should support array as a type:

class Post < YamlRecord::Base
  property :names, Array 
  property :user_ids, Array[Integer]
end

and that should allow:

p = Post.new
p.names = ["Bob", "Jane"]
p.user_ids = [1,2,3,4,5]
p.save

to

---
names: ["Bob", "Jane"]
user_id: [1,2,3,4,5]

but also support lists in string form:

p = Post.new
p.names = "Bob, Jane"
p.user_ids = "1, 2, 3, 4, 5"
p.save
p.names   # => ["Bob", "Jane"]
p.user_ids # => [1,2,3,4,5]
@ghost ghost assigned nicotaing Feb 1, 2012
@nesquena
Copy link
Collaborator Author

nesquena commented Feb 9, 2012

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

No branches or pull requests

2 participants