That’s a class level method, tho. Wouldn’t that make that particular attribute always readonly?

On Dec 12, 2013, at 11:10 AM, Mike Boone <notifications@github.com> wrote:

> In spec/provider/postgres_pgp_public_key_spec.rb:
> 
> > +          specify { subject.encrypt(plain_text).should_not be_empty }
> > +        end
> > +
> > +        context "Integers" do
> > +          specify { subject.encrypt(integer_plain_text).should_not == integer_plain_text }
> > +          specify { subject.encrypt(integer_plain_text).should_not be_empty }
> > +        end
> > +      end
> > +
> > +      describe "#decrypt" do
> > +        specify { subject.decrypt(cipher_text).should == plain_text }
> > +        specify { subject.decrypt(integer_cipher_text).should == integer_plain_text.to_s }
> > +
> > +        it "does not decrypt w/o private key" do
> > +          pgp = PostgresPgpPublicKey.new key: ENCRYPTION_PASSWORD, public_key: public_key
> > +          pgp.decrypt(cipher_text).should be_nil
> @jmazzi attr_readonly seems to skip serialized columns when it's enabled. So could you do something like attr_readonly(column) unless @private_key?
> 
> —
> Reply to this email directly or view it on GitHub.
>