Nico-Taing/yaml_record — Issue #6: Add associations
Author: nesquena
Created: 2012-02-01 08:56:21+00:00
State: open

We should add association support:

```ruby
class Post < YamlRecord::Base
belongs_to :episode
# auto-adds `property :episode_id, Integer`
end
```

This adds a `episode_id` integer foreign key reference. You can then do stuff like:

```ruby
p = Post.new
p.episode = Episode.find(5)
p.save
p.episode # =>
p.episode_id # => 5
```

or:

```ruby
p = Post.new
p.episode_id = 5
p.save
p.episode # =>
p.episode_id # => 5
```

Also adds `embeds_many` support:

```ruby
class Post < YamlRecord::Base
embeds_many :users
# adds property :user_ids, Array, Integer
end
```

and allows for:

```ruby
p = Post.new
p.user_ids = "1,2,3"
p.save
p.users # => [, , ]
```