Skip to content

Instantly share code, notes, and snippets.

@northband
Created September 20, 2012 16:37
Show Gist options
  • Save northband/bbc51211debb5ad11ea7 to your computer and use it in GitHub Desktop.
Save northband/bbc51211debb5ad11ea7 to your computer and use it in GitHub Desktop.
Tag.rb
class Tag < ActiveRecord::Base
attr_encrypted :title, :key => ATTR_ENCRYPTION_KEY, :encode => true
end
Loading development environment (Rails 3.2.8)
ruby-1.9.2-p290 :001 > t = Tag.new
=> #<Tag id: nil, account_id: nil, title: nil, created_at: nil, updated_at: nil, tag_type: nil, title_encrypted: nil>
ruby-1.9.2-p290 :002 > t.title = 'test'
=> "test"
ruby-1.9.2-p290 :003 > t.save
(0.3ms) BEGIN
SQL (0.4ms) INSERT INTO `tags` (`account_id`, `created_at`, `tag_type`, `title`, `title_encrypted`, `updated_at`) VALUES (NULL, '2012-09-20 16:35:55', NULL, NULL, NULL, '2012-09-20 16:35:55')
(2.3ms) COMMIT
=> true
ruby-1.9.2-p290 :004 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment