Fixed mass assignment to global_role_id

This commit is contained in:
George Vinogradov 2011-10-29 18:14:41 +04:00
parent 8f3ffbe827
commit 14bc7acc0b
2 changed files with 3 additions and 2 deletions

View File

@ -28,6 +28,7 @@ class UsersController < ApplicationController
def create
@user = User.new params[:user]
@user.global_role_id = params[:user]['global_role_id']
if @user.save
flash[:notice] = t('flash.user.saved')
redirect_to users_path
@ -38,7 +39,7 @@ class UsersController < ApplicationController
end
def update
puts params[:user].inspect
@user.global_role_id = params[:user]['global_role_id']
if @user.update_attributes(params[:user])
flash[:notice] = t('flash.user.saved')
redirect_to users_path

View File

@ -30,7 +30,7 @@ class User < ActiveRecord::Base
errors.add(:uname, I18n.t('flash.user.group_uname_exists')) if Group.exists? :uname => uname
}
attr_accessible :email, :password, :password_confirmation, :remember_me, :login, :name, :ssh_key, :uname, :global_role_id
attr_accessible :email, :password, :password_confirmation, :remember_me, :login, :name, :ssh_key, :uname
attr_readonly :uname
attr_accessor :login