rails_generators/lockdown/templates/app/controllers/users_controller.rb in lockdown-0.5.9 vs rails_generators/lockdown/templates/app/controllers/users_controller.rb in lockdown-0.5.10
- old
+ new
@@ -23,11 +23,10 @@
# GET /users/new
# GET /users/new.xml
def new
@user = User.new
- @profile = Profile.new
@user_groups_for_user = Lockdown::System.user_groups_assignable_for_user(current_user)
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @user }
end
@@ -40,13 +39,11 @@
# POST /users
# POST /users.xml
def create
@user = User.new(params[:user])
- @profile = Profile.new(params[:profile])
- @user.profile = @profile
if @user.save
flash[:notice] = "Thanks for signing up!"
redirect_to(users_path)
else
@user_groups_for_user = Lockdown::System.user_groups_assignable_for_user(current_user)
@@ -56,11 +53,10 @@
end
# PUT /users/1
# PUT /users/1.xml
def update
- @user.profile.attributes = params[:profile]
@user.attributes = params[:user]
respond_to do |format|
if @user.save
flash[:notice] = 'User was successfully updated.'
@@ -99,10 +95,9 @@
# Raise error if id not = current logged in user
raise SecurityError.new if (current_user_id != params[:id].to_i)
end
@user = User.find(params[:id])
raise SecurityError.new if @user.nil?
- @profile = @user.profile
end
def update_user_groups
new_ug_ids = params.collect{|p| p[0].split("_")[1].to_i if p[0] =~ /^ug_/}.compact
#