Created
July 28, 2008 03:38
-
-
Save carllerche/2834 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
attr_protected :staff | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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