Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Correcting error with creating an object with a HashWithIndifferentAc…

…cess
  • Loading branch information...
commit 07a1ee8ee752fb8e1dab99b5b37d88e5b09810de 1 parent 9a41b29
@Veraticus authored
View
1  Gemfile
@@ -15,7 +15,6 @@ group :development do
gem "rspec"
gem "bundler"
gem "jeweler"
- gem "rcov"
gem "yard"
gem "redcarpet", '1.17.2'
gem 'github-markup'
View
2  Gemfile.lock
@@ -32,7 +32,6 @@ GEM
multi_xml (0.4.1)
nokogiri (1.5.0)
rake (0.9.2.2)
- rcov (0.9.11)
redcarpet (1.17.2)
rspec (2.8.0)
rspec-core (~> 2.8.0)
@@ -57,7 +56,6 @@ DEPENDENCIES
jeweler
mocha
rake
- rcov
redcarpet (= 1.17.2)
rspec
tzinfo
View
3  lib/dynamoid/persistence.rb
@@ -38,7 +38,8 @@ def table_exists?(table_name)
#
# @since 0.2.0
def undump(incoming = nil)
- (incoming ||= {}).symbolize_keys!
+ incoming ||= {}
+ incoming = incoming.symbolize_keys
Hash.new.tap do |hash|
self.attributes.each do |attribute, options|
hash[attribute] = undump_field(incoming[attribute], options[:type])
View
3  spec/dynamoid/indexes/index_spec.rb
@@ -94,6 +94,9 @@
@index = Dynamoid::Indexes::Index.new(User, :name)
@user = User.create(:name => 'Josh', :password => 'test123', :last_logged_in_at => @time, :id => 'test123')
+ Dynamoid::Adapter.read("dynamoid_tests_index_user_names", 'Josh')[:ids].should == Set['test123']
+ Dynamoid::Adapter.read("dynamoid_tests_index_user_names", 'Justin').should be_nil
+
@user.update_attributes(:name => 'Justin')
Dynamoid::Adapter.read("dynamoid_tests_index_user_names", 'Josh')[:ids].should be_nil
View
6 spec/dynamoid/persistence_spec.rb
@@ -138,5 +138,11 @@
@address.city_was.should == 'Chicago'
end
+
+ it 'works with a HashWithIndifferentAccess' do
+ hash = ActiveSupport::HashWithIndifferentAccess.new("test" => "hi", "hello" => "there")
+
+ lambda {Address.create(hash)}.should_not raise_error
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.