Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zarqman/unprotect_attributes

Rails 2.x plugin to override attr_protected/attr_accessible. Useful for admin interfaces.
https://github.com/zarqman/unprotect_attributes

Last synced: 2 days ago
JSON representation

Rails 2.x plugin to override attr_protected/attr_accessible. Useful for admin interfaces.

Awesome Lists containing this project

README

        

UnprotectAttributes
===================
Copyright 2008 t.e.morgan.
License: MIT

Updates/info: http://iprog.com/project/unprotect_attributes
Contact: [email protected]

A plugin to add methods to ActiveRecord to modify all attributes, including
protected ones. This is useful where some attributes are protected for general
user access, but a separate admin controller should be able to update
everything.

Installation:
Simply add this plugin into your rails app.

To add to your rails app:
./script/plugin install http://svn.iprog.com/projects/rails/plugins/unprotect_attributes

Methods:
protected_attributes=(attributes)
Use just like attributes=.
Example: @user.protected_attributes = {:role=>'admin'}

update_protected_attributes(attributes) // update_protected_attributes!(attributes)
Use just like update_attributes and update_attributes!.
Example: @user.update_protected_attributes :role=>'admin'

Other Notes:
Tested only with Rails 2.1, although I suspect it will work with 2.0 and 1.2.

If you find a bug, have a suggestion, or just want to tell me that it works,
I'd love to hear from you. Thanks for checking unprotect_attributes out!

--t ([email protected]; http://iprog.com/)