vinaigrette 0.0.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@ module Vinaigrette::Model
14
14
 
15
15
  # Associations calls [] to retrieve attributes.
16
16
  def [] name
17
- attributes[name]
17
+ attributes[name.to_sym]
18
18
  end
19
19
 
20
20
  # association_cache is assumed to exist by ActiveRecord::Associations
@@ -1,3 +1,3 @@
1
1
  module Vinaigrette
2
- VERSION = "0.0.2"
2
+ VERSION = "0.9.0"
3
3
  end
@@ -49,6 +49,14 @@ describe Vinaigrette::Base do
49
49
  assert_equal({recipe_id: "MyRecipe"}, sauce.serializable_hash)
50
50
  end
51
51
 
52
+ it 'should support access by name (needed by belongs_to)' do
53
+ DeliciousSauce.send(:attr_accessor, :recipe_id)
54
+ sauce = DeliciousSauce.new
55
+ sauce.recipe_id = 42
56
+ assert_equal(42, sauce[:recipe_id])
57
+ assert_equal(42, sauce['recipe_id'])
58
+ end
59
+
52
60
  it 'should support vinaigrette_accessor' do
53
61
  DeliciousSauce.send(:vinaigrette_accessor, :recipe_id, Integer)
54
62
  sauce = DeliciousSauce.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vinaigrette
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-03 00:00:00.000000000 Z
12
+ date: 2013-01-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake