datts_right 0.0.26 → 0.0.27

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.
data/Gemfile.lock CHANGED
@@ -1,9 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- datts_right (0.0.25)
4
+ datts_right (0.0.26)
5
5
  datts_right
6
- rails (>= 3.0.0)
7
6
 
8
7
  GEM
9
8
  remote: http://rubygems.org/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.26
1
+ 0.0.27
data/datts_right.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{datts_right}
8
- s.version = "0.0.26"
8
+ s.version = "0.0.27"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ramon Tayag"]
@@ -127,6 +127,16 @@ module DattsRight
127
127
  key = key.to_sym
128
128
  #puts "add_definition(:#{key}, #{value.inspect}). current definition: #{definition.nil?}"
129
129
  if dynamic_attributes_options[:definition]
130
+ #puts ":definition is true, so let's see if definition[:#{key}] already exists"
131
+ # Checking definition straight seems to cause a problem. Is this a bug with Rails?
132
+ # The problem was like this (assuming definition was actually nil):
133
+ # definition.nil? # false
134
+ # definition.inspect # nil
135
+ # definition.class.name # NilClass
136
+ #
137
+ # How in the world can .nil? return false when it was nil??
138
+ dynamic_attribute_definition.definition ||= {}
139
+
130
140
  if definition[key]
131
141
  raise AlreadyDefined, "#{key} is already defined"
132
142
  else
@@ -28,4 +28,11 @@ describe DattsRight, ".add_definition(key, value)" do
28
28
  it "should raise AttributeKeyRequired if no attr_key is passed" do
29
29
  lambda {Page.create.add_definition(nil, {})}.should raise_error(DattsRight::AttributeKeyRequired)
30
30
  end
31
+
32
+ it "should be able to handle if definition is nil" do
33
+ c = Category.create
34
+ c.definition = nil
35
+ c.save
36
+ lambda {c.add_definition(:real, :object_type => "string")}.should_not raise_error(NoMethodError)
37
+ end
31
38
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datts_right
3
3
  version: !ruby/object:Gem::Version
4
- hash: 43
4
+ hash: 41
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 26
10
- version: 0.0.26
9
+ - 27
10
+ version: 0.0.27
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ramon Tayag