orbit-basic/app/controllers/basic_infos_controller.rb

38 lines
756 B
Ruby

class BasicInfosController < ApplicationController
layout "devise"
def index
if current_user.nil?
redirect_to "/users/sign_up"
end
@user = current_user
end
def form_page
@user = User.find(params[:user_id])
end
def basic_info_update
@user = User.find(params[:id])
if @user.update_attributes(params[:user])
redirect_to basic_infos_role_page_path(:user_id => @user.id.to_s)
else
render :action=> "form_page"
end
end
def role_page
@roles = Role.where(:disabled => false)
@user_id = params[:user_id]
end
def role_update
user = User.find(params[:id])
if user.update_attributes(params[:user])
redirect_to root_path
else
@roles = Role.where(:disabled => false)
render :action => "role_page"
end
end
end