This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#encoding utf-8 | |
require 'rubygems' | |
# this searches up the directory path to find Gemfile: | |
#source 'https://rubygems.org' | |
#gem 'mongo_mapper', :git => "git://github.com/mongomapper/mongomapper.git", :tag => "v0.13.0.beta2" | |
#gem 'bson_ext' | |
#gem 'minitest' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ArgumentError: Unknown key: persistence_method | |
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.15/lib/active_support/core_ext/hash/keys.rb:51:in `block in assert_valid_keys' | |
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.15/lib/active_support/core_ext/hash/keys.rb:50:in `each_key' | |
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.15/lib/active_support/core_ext/hash/keys.rb:50:in `assert_valid_keys' | |
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/mongomapper-9b87dee50780/lib/mongo_mapper/plugins/querying.rb:102:in `save' | |
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/mongomapper-9b87dee50780/lib/mongo_mapper/plugins/dirty.rb:17:in `block in save' | |
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/mongomapper-9b87dee50780/lib/mongo_mapper/plugins/dirty.rb:27:in `clear_changes' | |
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/mongomapper-9b87dee50780/lib/mongo_mapper/plugins/dirty.rb:17:in `save' | |
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/mon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rvm use 1.9.2 # or the ruby implementation of choice | |
rvm gemset use global | |
gem install bundler |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby-1.9.1-p378 > require 'bug' | |
to_mongo("plain text")...OK | |
Expect errors here... | |
from_mongo("encrypted text")...OK | |
to_mongo("plain text")...OK | |
to_mongo("encrypted text")...Error? ["/home/jjw/.rvm/gems/ruby-1.9.1-p378/gems/mongo_mapper-0.8.3/lib/mongo_mapper/plugins/keys/key.rb:45:in `set'", "/home/jjw/.rvm/gems/ruby-1.9.1-p378/gems/mongo_mapper-0.8.3/lib/mongo_mapper/plugins/keys.rb:309:in `write_key'", "/home/jjw/.rvm/gems/ruby-1.9.1-p378/gems/mongo_mapper-0.8.3/lib/mongo_mapper/plugins/keys.rb:243:in `[]='", "/home/jjw/.rvm/gems/ruby-1.9.1-p378/gems/mongo_mapper-0.8.3/lib/mongo_mapper/plugins/keys.rb:269:in `block in load_from_database'"] | |
from_mongo("encrypted text")...OK | |
to_mongo("plain text")...OK |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mongo_mapper' | |
include MongoMapper | |
MongoMapper.database = "mm-test" | |
$db = MongoMapper.database | |
class EncryptedPassword | |
def self.to_mongo(value) | |
print "to_mongo(#{value.inspect})..."; | |
return('') if value.nil? |