Sha256: b3b09a1b38e113b671c703c55bde88a17166ad7739c97f123e0f2a91f8298943

Contents?: true

Size: 1.99 KB

Versions: 4

Compression:

Stored size: 1.99 KB

Contents

# HotLikeSauce
#### For when your data is too hot to view

This is some sweet code for ActiveRecord (rails) that will allow you to obscure database fields. The data will always be obscured in the database, but can be read as plaintext or obscured. This is useful for admin views where you can display obscured data for people who shouldn't be seeing it.

## Usage

```ruby
gem 'hot_like_sauce'
```

```ruby
class Post < ActiveRecord::Base
  attr_obscurable :body
end
```

By default, when you read the value you get the original plain text.

```ruby
p = Post.create(:body => "readable text")
p.body
#=> "readable text"

Post.obscure_read_on_fields!(:body)
p.body
#=> "էu??+]?S???^Vx????gzq?'?"
```

You can configure this on a per field basis by default

```ruby
class Post < ActiveRecord::Base
  attr_obscurable :body, :obscure_on_read => true
end

p = Post.create(:body => "readable text")
p.body
#=> "էu??+]?S???^Vx????gzq?'?"
```

`Post.obscure_read_on_fields!` can be called with no arguments to set all attr_obscurable fields. The inverse method is `Post.unobscure_read_on_fields!`

## Configuration

```ruby
HotLikeSauce.secret_key = "this-should-be-long-and-random"

HotLikeSauce.crypto_method = "aes-256-cbc" # default's to aes-256-cbc
```

## Contributing to hot-like-sauce

* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
* Fork the project.
* Start a feature/bugfix branch.
* Commit and push until you are happy with your contribution.
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

## Copyright

Copyright (c) 2012 Justin Derrek Van Eaton. See LICENSE.txt for
further details.

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hot_like_sauce-0.2.3 README.md
hot_like_sauce-0.2.2 README.md
hot_like_sauce-0.2.1 README.md
hot_like_sauce-0.2.0 README.md