class OnboardingController

Public Instance Methods

continue() click to toggle source
# File lib/generators/hello/install/templates/onboarding/onboarding_controller.rb, line 7
def continue
  respond_to do |format|
    if update(params[:role])
      format.html { redirect_to root_path, notice: 'Welcome!' }
      format.json { render json: { user: current_user.as_json_web_api }, status: :ok }
    else
      format.html { render action: 'index' }
      format.json { render json: { errors: 'invalid role supplied' }, status: :unprocessable_entity }
    end
  end
end
index() click to toggle source
# File lib/generators/hello/install/templates/onboarding/onboarding_controller.rb, line 4
def index
end

Private Instance Methods

update(role) click to toggle source
# File lib/generators/hello/install/templates/onboarding/onboarding_controller.rb, line 21
def update(role)
  case role
  when 'user'
    current_user.update! role: 'user'
    return true
  when 'webmaster'
    current_user.update! role: 'webmaster'
    return true
  else
    return false
  end
end