온보딩 플로우 — 4단계 컨트롤러 + 뷰 + 테스트
ID: b0e6d3b8-e60a-466f-9be5-f8176aba5215
## 목표
온보딩 4단계 구현. Onboarding::StepsController + 뷰 + 테스트.
## PRD 라우트 (Section 10)
```ruby
namespace :onboarding do
get "/", to: "steps#index" # → nineways로 리다이렉트
get "/nineways", to: "steps#nineways" # Step 1
post "/nineways", to: "steps#connect_nineways"
get "/goal", to: "steps#goal" # Step 2
post "/goal", to: "steps#save_goal"
get "/level", to: "steps#level" # Step 3
post "/level", to: "steps#save_level"
get "/idea", to: "steps#idea" # Step 4
post "/idea", to: "steps#save_idea"
get "/complete", to: "steps#complete" # 완료 페이지
end
```
## 현재 상태
- User 모델에 onboarding_goal(enum), dev_level(enum), onboarding_completed(boolean) 존재
- 라이트 테마 랜딩페이지 구현됨
- ⚠️ 랜딩페이지가 라이트 테마 (bg-[#FAFAF7])로 되어있지만, 온보딩은 앱 내부이므로 기존 다크 테마 토큰 사용 (bg-bg, text-text-primary, bg-accent 등)
## 구현 사항
### 1. config/routes.rb에 온보딩 네임스페이스 추가
기존 라우트 유지하면서 추가. `resource :session` 바로 아래에:
```ruby
namespace :onboarding do
get "/", to: "steps#index"
get "nineways", to: "steps#nineways"
post "nineways", to: "steps#connect_nineways"
get "goal", to: "steps#goal"
post "goal", to: "steps#save_goal"
get "level", to: "steps#level"
post "level", to: "steps#save_level"
get "idea", to: "steps#idea"
post "idea", to: "steps#save_idea"
get "complete", to: "steps#complete"
end
```
### 2. Onboarding::StepsController
```ruby
class Onboarding::StepsController < ApplicationController
before_action :redirect_if_completed
def index
redirect_to onboarding_nineways_path
end
# Step 1: 9WAY 연동 (선택)
def nineways; end
def connect_nineways
# 9WAY 연동은 나중 구현 — 지금은 건너뛰기만
redirect_to onboarding_goal_path
end
# Step 2: 목표 선택
def goal; end
def save_goal
Current.user.update!(onboarding_goal: params[:onboarding_goal])
redirect_to onboarding_level_path
end
# Step 3: 개발 수준
def level; end
def save_level
Current.user.update!(dev_level: params[:dev_level])
redirect_to onboarding_idea_path
end
# Step 4: 첫 아이디어
def idea; end
def save_idea
# 아이디어는 나중에 Project로 연결 — 지금은 온보딩 완료만
Current.user.update!(onboarding_completed: true)
redirect_to onboarding_complete_path
end
def complete
# 온보딩 완료 축하 페이지
end
private
def redirect_if_completed
redirect_to root_path if Current.user&.onboarding_completed?
end
end
```
### 3. 뷰 (app/views/onboarding/steps/)
- 다크 테마 (기존 디자인 토큰 사용: bg-bg, bg-surface, text-accent 등)
- 진행 인디케이터: 상단에 4단계 표시 (Step 1/4, 2/4, 3/4, 4/4)
- 각 단계별:
- **nineways.html.erb**: 9WAY 연동 안내 + "건너뛰기" 버튼
- **goal.html.erb**: 4가지 목표 라디오 버튼 (saas/side_income/portfolio/validation)
- **level.html.erb**: 4가지 레벨 라디오 버튼 (no_experience/basic/intermediate/developer)
- **idea.html.erb**: textarea로 아이디어 입력
- **complete.html.erb**: 축하 메시지 + 대시보드 이동 CTA
- 기존 shared partial 활용 (_button, _card, _input)
- 한국어 텍스트
### 4. ApplicationController에 온보딩 체크
이미 인증된 사용자가 온보딩 미완료 시 리다이렉트:
```ruby
# app/controllers/application_controller.rb
before_action :check_onboarding
def check_onboarding
return unless authenticated?
return if Current.user&.onboarding_completed?
return if controller_path.start_with?("onboarding")
return if controller_path.in?(["sessions", "passwords", "registrations", "pages"])
redirect_to onboarding_path
end
```
### 5. 테스트
- 각 단계 접근 가능 (인증 필요)
- save_goal → User.onboarding_goal 업데이트
- save_level → User.dev_level 업데이트
- save_idea → User.onboarding_completed = true
- 온보딩 완료 시 redirect_to root_path
- 미인증 사용자 → 로그인 리다이렉트
- 온보딩 완료 후 재방문 시 root 리다이렉트
## ⚠️ 주의
- developer-1이 동시에 DB 마이그레이션 작업 중 — 충돌 방지 위해 user.rb의 has_many 추가는 developer-1 담당
- routes.rb 변경 시 기존 라우트 유지 (root "pages#landing", sessions, passwords, registrations)
- 온보딩 뷰는 다크 테마 (앱 내부) — 랜딩페이지의 라이트 테마와 다름
- 기존 PagesController 테스트, Sessions/Passwords/Registrations 테스트 깨지지 않게 주의
## 완료 기준
- 4단계 순차 진행 가능
- 각 단계에서 User 필드 업데이트
- 온보딩 미완료 시 리다이렉트
- 진행 인디케이터 UI
- bin/rails test 전체 통과
첨부 이미지
이미지 추가 (Ctrl+V로 붙여넣기 또는 클릭)
JPEG, PNG, GIF, WebP / 최대 10MB
활동 로그
-
팀팀리드 상태 변경: 리뷰 → 완료
2026년 03월 26일 08:05:48
-
Ddeveloper-2 상태 변경: 할 일 → 리뷰
2026년 03월 26일 07:48:20