bsns 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/bsns.rb +2 -2
  2. data/spec/bsns_spec.rb +7 -0
  3. metadata +2 -2
data/lib/bsns.rb CHANGED
@@ -11,7 +11,7 @@ module BSNS
11
11
  model = model.to_s.singularize
12
12
  class_eval do
13
13
  define_method field do
14
- obj_from_dataset instance_variable_get("@#{field}"), model, opts
14
+ collection_from_array instance_variable_get("@#{field}"), model, opts
15
15
  end
16
16
  end
17
17
  end
@@ -21,7 +21,7 @@ module BSNS
21
21
  field = opts[:as] || model.downcase
22
22
  class_eval do
23
23
  define_method field do
24
- klass = model.capitalize.constantize.load
24
+ klass = model.capitalize.constantize
25
25
  data = instance_variable_get "@#{field}"
26
26
  if opts[:embedded]
27
27
  obj = klass.new data
data/spec/bsns_spec.rb CHANGED
@@ -10,6 +10,7 @@ class Buzzle < BSNS::Base
10
10
  has_many :fizzles
11
11
  has_many :fizzles, :as => :enemies, :with => :reason
12
12
  has_many :fizzles, :as => :opinions, :with => :opinion
13
+ has_one :cat, :embedded => true
13
14
 
14
15
  end
15
16
 
@@ -131,4 +132,10 @@ describe BSNS do
131
132
  fazz.cats[1].thing.should == 'hats'
132
133
  end
133
134
 
135
+ it "should load one has_many item as an array" do
136
+ fuzz = Fizzle.load 'fuzz'
137
+ fuzz.cats.length.should == 1
138
+ fuzz.cats[0].thing.should == 'bad breath'
139
+ end
140
+
134
141
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bsns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
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-08-23 00:00:00.000000000 Z
12
+ date: 2013-08-25 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Static YAML assets which live in your application repositories. For
15
15
  the streamlined modification of informational, promotional and business assets by