0.0
No commit activity in last 3 years
No release in over 3 years
Autohides sensitive attributes (such as passwords) when rendering XML or JSON from ActiveRecord model
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme
= HideAttributes

This plugin generates wrappers to `to_xml` and `to_json` methods to
automatically exclude attributes such as passwords from output.


== Example

To auto-hide password fields from generated JSON output, add this to your model:

  class User < ActiveRecord::Base

    hide_attributes :password, :password_salt

  end


Then use as usual:

  user = User.first

  # Output user's JSON without hidden attributes present
  user.to_json

  # Temporarly override hiding and output all attributes
  user.to_json :except => nil


== INSTALL

To install simply add it to your _Gemfile_

  gem 'hide_attributes'

And run bundle:

  bundle install


== Requirements

Runtime requirements are:

* ActiveRecord >=3.0

== TODO

* Write tests

Copyright (c) 2011 Laas Toom, released under the MIT license