{"action":"created","issue":{"url":"https://api.github.com/repos/attr-encrypted/attr_encrypted/issues/215","repository_url":"https://api.github.com/repos/attr-encrypted/attr_encrypted","labels_url":"https://api.github.com/repos/attr-encrypted/attr_encrypted/issues/215/labels{/name}","comments_url":"https://api.github.com/repos/attr-encrypted/attr_encrypted/issues/215/comments","events_url":"https://api.github.com/repos/attr-encrypted/attr_encrypted/issues/215/events","html_url":"https://github.com/attr-encrypted/attr_encrypted/issues/215","id":155784666,"number":215,"title":"2.0 -> 3.0 migration example isn't correct","user":{"login":"pnomolos","id":36223,"avatar_url":"https://avatars.githubusercontent.com/u/36223?v=3","gravatar_id":"","url":"https://api.github.com/users/pnomolos","html_url":"https://github.com/pnomolos","followers_url":"https://api.github.com/users/pnomolos/followers","following_url":"https://api.github.com/users/pnomolos/following{/other_user}","gists_url":"https://api.github.com/users/pnomolos/gists{/gist_id}","starred_url":"https://api.github.com/users/pnomolos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnomolos/subscriptions","organizations_url":"https://api.github.com/users/pnomolos/orgs","repos_url":"https://api.github.com/users/pnomolos/repos","events_url":"https://api.github.com/users/pnomolos/events{/privacy}","received_events_url":"https://api.github.com/users/pnomolos/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-05-19T16:51:52Z","updated_at":"2016-08-23T17:40:01Z","closed_at":"2016-07-14T05:44:58Z","body":"This line:\r\n\r\n```ruby\r\nattr_encrypted :ssn, key: :encryption_key, v2_gcm_iv: :is_decrypting?(:ssn)\r\n```\r\n\r\nis invalid syntax.  As well, \r\n\r\n```ruby\r\ndef is_decrypting?(attribute)\r\n  encrypted_atributes[attribute][operation] == :decrypting\r\nend\r\n```\r\n\r\nmisspells `encrypted_attributes` and references `operation` instead of `:operation`\r\n\r\nI'd write a PR, but I'm not sure what to suggest.  As far as I can tell, the `attr_encrypted` options pass the instance to callable options, not the attribute being evaluated."},"comment":{"url":"https://api.github.com/repos/attr-encrypted/attr_encrypted/issues/comments/241813441","html_url":"https://github.com/attr-encrypted/attr_encrypted/issues/215#issuecomment-241813441","issue_url":"https://api.github.com/repos/attr-encrypted/attr_encrypted/issues/215","id":241813441,"user":{"login":"saghaulor","id":273862,"avatar_url":"https://avatars.githubusercontent.com/u/273862?v=3","gravatar_id":"","url":"https://api.github.com/users/saghaulor","html_url":"https://github.com/saghaulor","followers_url":"https://api.github.com/users/saghaulor/followers","following_url":"https://api.github.com/users/saghaulor/following{/other_user}","gists_url":"https://api.github.com/users/saghaulor/gists{/gist_id}","starred_url":"https://api.github.com/users/saghaulor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saghaulor/subscriptions","organizations_url":"https://api.github.com/users/saghaulor/orgs","repos_url":"https://api.github.com/users/saghaulor/repos","events_url":"https://api.github.com/users/saghaulor/events{/privacy}","received_events_url":"https://api.github.com/users/saghaulor/received_events","type":"User","site_admin":false},"created_at":"2016-08-23T17:40:01Z","updated_at":"2016-08-23T17:40:01Z","body":"@rally25rs it is a bit confusing, but the options are evaluated in the context of the instantiated object, not the class, as you alluded to, and as documented here https://github.com/attr-encrypted/attr_encrypted#options-are-evaluated\r\n\r\nThis allows you to make decisions during the different operations, for example, to switch which encryption key is used during decryption and encryption. Consequently, a path forward is provided for migrating from one implementation to another."}}
{"actor":{"display_login":"saghaulor"}}