spikex/strongbox — Issue #18: Cannot visit Strongbox::Lock - error
Author: oleander
Created: 2011-10-23 20:43:42+00:00
State: open

I'm getting this error message when trying to use Strongbox for more then one field.

`Cannot visit Strongbox::Lock`

Here is the model related code.

``` ruby
encrypt_with_public_key :password, key_pair: File.join(Rails.root, "config", "keypairs.pem")
encrypt_with_public_key :username, key_pair: File.join(Rails.root, "config", "keypairs.pem")
```

Here is the `schema.rb` file.

``` ruby
create_table "users", :force => true do |t|
# ...
t.binary "password"
t.binary "password_key"
t.binary "password_iv"
t.binary "username"
t.binary "username_key"
t.binary "username_iv"
end
```
I'm using Strongbox `0.4.8`, with Rails `3.1.1`.

The error occur when trying *save* an active record object.

Here is an example.

``` ruby
User.create!(username: "A", password: "B") # Fails
````

``` ruby
user = User.new
user.username = "A"
user.password = "B"

save! # Fails
```

Any ideas why this is happening?