Created
July 16, 2012 17:11
-
-
Save karapetyan/3123827 to your computer and use it in GitHub Desktop.
Mass-assigment attr_accessable
This file contains hidden or 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
| def create | |
| @user = User.new | |
| @user = (params[:user].delete("admin")) | |
| @user.admin = (params[:user][:admin] == "1") | |
| if @user.save | |
| flash[:notice] = "User succesfully created!" | |
| redirect_to [:admin, @user] | |
| else | |
| flash.now[:alert] = "User was not created!" | |
| render :action => "new" | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment