mirror of
https://github.com/System-End/highway.git
synced 2026-04-19 23:22:53 +00:00
49 lines
954 B
Ruby
49 lines
954 B
Ruby
class ProjectsController < ApplicationController
|
|
before_action :set_project, only: %i[ show edit update ]
|
|
before_action :require_authentication, only: [:show, :edit, :update]
|
|
|
|
|
|
def index
|
|
@projects = Project.all
|
|
end
|
|
|
|
def show
|
|
end
|
|
|
|
def new
|
|
@project = Project.new
|
|
end
|
|
|
|
def create
|
|
@project = Project.new(project_params)
|
|
@project.user = current_user
|
|
if @project.save
|
|
redirect_to @project
|
|
else
|
|
render :new, status: :unprocessable_entity
|
|
end
|
|
end
|
|
|
|
def edit
|
|
end
|
|
|
|
def update
|
|
if @project.update(project_params)
|
|
redirect_to @project, notice: "Project was successfully updated."
|
|
else
|
|
render :edit, status: :unprocessable_entity
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def set_project
|
|
@project = Project.find(params[:id])
|
|
end
|
|
|
|
def project_params
|
|
params.expect(project: [ :github_repo, :kitted_guide, :proposed_tier, :proposed_tier_explanation, :group_project, :name ])
|
|
end
|
|
|
|
|
|
end
|