Skip to content

Instantly share code, notes, and snippets.

@carllerche
Created July 28, 2008 03:38
Show Gist options
  • Save carllerche/2834 to your computer and use it in GitHub Desktop.
Save carllerche/2834 to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
attr_protected :staff
end
class Users < Application
# === Option 1 ===
def create
@user = User.first
User.allow_access(:staff) do
@user.update_attributes :staff => true
end
end
# === Option 2 ===
def create
@user = User.first
@user.update_attributes protected_user_params(params[:user])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment