Skip to content

Commit

Permalink
faqs_categoryテーブルを作成, faqテーブルにあったcategoryのcalumnを削除
Browse files Browse the repository at this point in the history
  • Loading branch information
sochi419 committed Mar 26, 2024
1 parent 5175305 commit a879736
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 40 deletions.
3 changes: 2 additions & 1 deletion app/controllers/welcome_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def pricing; end

def faq
@faqs = if params[:category].present?
FAQ.where(category: params[:category])
category = FaqsCategory.find_by(name: params[:category])
FAQ.where(faqs_categories_id: category.id) if category.present?
else
FAQ.all
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/faq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
class FAQ < ApplicationRecord
validates :answer, presence: true, uniqueness: { scope: :question }
validates :question, presence: true, uniqueness: true
validates :category, presence: true

default_scope -> { order(:position) }
belongs_to :faqs_categories
acts_as_list
end
5 changes: 5 additions & 0 deletions app/models/faqs_category.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

class FaqsCategory < ApplicationRecord
has_many :faqs, dependent: :destroy
end
42 changes: 21 additions & 21 deletions db/fixtures/faqs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ faq1:
フィヨルドブートキャンプとしては、卒業までの時間が長くなり過ぎないように、泣く泣くカリキュラムを削ったりなどもしているのですが、年々就職希望者に求めるものが増えているので、削っても削っても増えていってしまい、なかなか卒業までの時間を短縮させるのが難しいです。\n\n\
とはいえ、就職した卒業生は、フィヨルドブートキャンプで学んだことで就職後に役に立たなかったことは何一つなかった、と言ってくれてます(自慢)。\
"
category: study_environment
faqs_categories: faqs_categories2

faq2:
position: 2
Expand All @@ -18,7 +18,7 @@ faq2:
フィヨルドブートキャンプでは、プログラマーになることを考えたけど、自分には向いていなかったことに気づくことも大きな価値だと考えています。\n\n\
プログラマーに向いてない、プログラミングが楽しめないと思ったときのリスクを最小限にするため、一度に大金を支払うのではなく、月額課金制にしています。\
"
category: withdrawal_hibernation_graduation
faqs_categories: faqs_categories6

faq3:
position: 3
Expand All @@ -27,13 +27,13 @@ faq3:
オンラインだけです。\n\n\
オンラインだけですが、オンラインの強みを活かして、住んでいる場所を問わずに参加できる飲み会、卒業式、受講生が主催の勉強会、受講生が主催の発表会、質問タイム、雑談会などの何かしらのオンラインイベントが毎日のように開催されています。\
"
category: study_environment
faqs_categories: faqs_categories2

faq4:
position: 4
question: 休会をすることは可能ですか
answer: 最大3ヶ月まで休会をすることが可能です。
category: withdrawal_hibernation_graduation
faqs_categories: faqs_categories6

faq5:
position: 5
Expand All @@ -44,43 +44,43 @@ faq5:
人によっては質問をすることが恥ずかしいと感じてしまう人もいまずが、質問をすることはプログラマーにとってとても重要なスキルの一つと考えているため、それを鍛えるためにたくさんの質問をする方法を用意しています。\n\n\
学習をする度に提出する日報に質問を書く、フィヨルドブートキャンプの学習アプリのQ&A機能を使って質問、質問ようのチャットのチャンネルで質問、質問タイムでビデオチャットで質問、メンターにペアプログラミングを依頼...など、あらゆる質問をする手段を用意しています。\
"
category: study_environment
faqs_categories: faqs_categories2

faq6:
position: 6
question: 退会した月は料金が日割りで請求されますか
answer: 退会した月も、日割りでの請求はなく、その月のご利用料金1ヶ月分をお支払い頂きますことをご了承ください。
category: fee
faqs_categories: faqs_categories3

faq7:
position: 7
question: 仕事をしながら学習をしたいのであまり時間が取れないのですがそれでも参加できますか
answer: 学習時間の制限はありませんので、自分のできるペースで学習を進めることができます。ただ、卒業までに時間がかかってしまうと、それだけ合計の料金はかかってしまいます。
category: study_environment
faqs_categories: faqs_categories2

faq8:
position: 8
question: 就職先が決まっているのですが、就職までの間学習をしたいです。その場合、参加は可能ですか
answer: はい、そのような場合も参加可能です。実際、フィヨルドブートキャンプは企業の新人研修でも利用されています。もし、企業の研修として利用する場合は法人用のプランがございますのでご連絡ください。
category: join
faqs_categories: faqs_categories5

faq9:
position: 9
question: 転職は考えていないのですが、スキルアップのためプログラミングの勉強がしたいです。その場合、参加は可能ですか
answer: 可能です。フィヨルドブートキャンプは就職できるためのスキルを身につけることを目標にしていますが、就職を必ずしなくてはいけないという縛りはありません。
category: join
faqs_categories: faqs_categories5

faq10:
position: 10
question: 現在、大学に在学中なのですが、参加できますか
answer: 学生でも参加可能です。年齢に制限はありません。
category: join
faqs_categories: faqs_categories5

faq11:
position: 11
question: Linuxで学習をしたいのですが可能ですか
answer: Linuxでも可能ですが条件があります。用意しているカリキュラムは Mac を想定して作られています。そのため、Linux でカリキュラムを行う場合は自分自身でMac用のカリキュラムをLinuxに合わせて操作方法などを変える必要があります。それができるだけのLinuxのスキルがある方のみ、Linuxで学習をすることをOKとしています。
category: study_environment
faqs_categories: faqs_categories2

faq12:
position: 12
Expand All @@ -90,25 +90,25 @@ faq12:
[WSL2が使えるマシンとは?](https://bootcamp.fjord.jp/articles/32)\n\
[WSL2でLinuxを使おう](https://bootcamp.fjord.jp/articles/6)\
"
category: study_environment
faqs_categories: faqs_categories2

faq13:
position: 13
question: 古い OS のままで学習をしたいのですが可能ですか
answer: カリキュラムが、最新の Mac の OS を想定して作られています。多少古い場合はどうにかなるかもしれませんが、OS のせいで学習に詰まることが出てくるかもしれません。何かしら事情があってお手持ちの Mac のバージョンが上げられない場合は、それとは別の Mac を用意してから参加されることをおすすめします。
category: study_environment
faqs_categories: faqs_categories2

faq14:
position: 14
question: 転職エージェントを使って就職活動をすることは可能ですか
answer: はい、就職活動について制限はありません。希望があれば弊社でもエージェントを紹介することも可能です。
category: find_job
faqs_categories: faqs_categories4

faq15:
position: 15
question: 卒業生が Ruby 界隈で有名な企業に就職していますが、私もそういった企業に就職できますか
answer: 個人によります。弊社と仲良くしてくれてる Ruby 界隈で有名な企業に推薦をする場合もありますが、推薦をする側も責任があるため、誰でも推薦をすることができるとは言えません。ただし、そもそもフィヨルドブートキャンプを卒業することはとても難しく、それを達成できた時点で十分推薦できる人物だと判断することがほとんどです。
category: find_job
faqs_categories: faqs_categories4

faq16:
position: 16
Expand All @@ -118,7 +118,7 @@ faq16:
フィヨルドブートキャンプでは、入会時に性別を聞くことはしていないので、正確な数字は出せないのですが、女性比率は男性 : 女性で半々に近いくらい高いです。イベントによっては女性の参加者の方が多いこともあります。\n\n\
たくさんの女性が卒業しプログラマーとして就職し活躍しています。\
"
category: join
faqs_categories: faqs_categories5

faq17:
position: 17
Expand All @@ -130,7 +130,7 @@ faq17:
30代半ばを超えていたら、今持っているスキル + プログラミングスキルを使って、どの会社でどんな仕事をすれば自分の価値を出せるか?そのためには、どのような就活を行うべきかの戦略とプランも考えておく必要があります。\n\n\
また、40代以上に強そうな転職エージェントを探し、予め相談してからフィヨルドブートキャンプを始めるかを検討するのもいいかもしれません。\
"
category: study_environment
faqs_categories: faqs_categories2

faq18:
position: 18
Expand All @@ -139,7 +139,7 @@ faq18:
可能です。\n\n\
法人でのご利用については[こちら](https://bootcamp.fjord.jp/training)に詳細を記載しております。\
"
category: corporate_use
faqs_categories: faqs_categories7

faq19:
position: 19
Expand All @@ -148,7 +148,7 @@ faq19:
全てのプラクティスを修了したら卒業になります。\n\n\
最後のプラクティスが自作サービスをリリースする、というものになっています。月に一回行っている卒業式で、自作サービスの発表をしてもらい、その後に卒業証書授与を行っています。\
"
category: withdrawal_hibernation_graduation
faqs_categories: faqs_categories6

faq20:
position: 20
Expand All @@ -157,7 +157,7 @@ faq20:
発行します。\n\n\
Stripe という決済サービスを利用しているのですが、それが発行する領収書をダウンロードすることができます。\
"
category: fee
faqs_categories: faqs_categories3

faq21:
position: 21
Expand All @@ -167,4 +167,4 @@ faq21:
フィヨルドブートキャンプは、年齢、性別、本名を伝えることなく利用することができます。フィヨルドブートキャンプ内では、お互いをニックネームで呼び合っています。\n\n\
オンラインイベントの中では、ビデオチャットで顔出しをするイベントもありますが、カメラをオンにすることは強制していません。\
"
category: study_environment
faqs_categories: faqs_categories2
20 changes: 20 additions & 0 deletions db/fixtures/faqs_categories.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
faqs_categories1:
name: study_content

faqs_categories2:
name: study_environment

faqs_categories3:
name: fee

faqs_categories4:
name: find_job

faqs_categories5:
name: join

faqs_categories6:
name: withdrawal_hibernation_graduation

faqs_categories7:
name: corporate_use
5 changes: 0 additions & 5 deletions db/migrate/20240220130916_add_category_to_faqs.rb

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 9 additions & 0 deletions db/migrate/20240313020054_create_faqs_categories.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateFaqsCategories < ActiveRecord::Migration[6.1]
def change
create_table :faqs_categories do |t|
t.string :name

t.timestamps
end
end
end
5 changes: 5 additions & 0 deletions db/migrate/20240313025400_add_foreign_key_to_faqs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddForeignKeyToFaqs < ActiveRecord::Migration[6.1]
def change
add_reference :faqs, :faqs_categories, foreign_key: true
end
end
12 changes: 10 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2024_02_28_105218) do
ActiveRecord::Schema.define(version: 2024_03_13_025400) do

# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
Expand Down Expand Up @@ -259,11 +259,18 @@
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.integer "position"
t.string "category", null: false
t.bigint "faqs_categories_id"
t.index ["answer", "question"], name: "index_faqs_on_answer_and_question", unique: true
t.index ["faqs_categories_id"], name: "index_faqs_on_faqs_categories_id"
t.index ["question"], name: "index_faqs_on_question", unique: true
end

create_table "faqs_categories", force: :cascade do |t|
t.string "name"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end

create_table "followings", force: :cascade do |t|
t.integer "follower_id"
t.integer "followed_id"
Expand Down Expand Up @@ -783,6 +790,7 @@
add_foreign_key "check_boxes", "survey_questions"
add_foreign_key "discord_profiles", "users"
add_foreign_key "external_entries", "users"
add_foreign_key "faqs", "faqs_categories", column: "faqs_categories_id"
add_foreign_key "hibernations", "users"
add_foreign_key "images", "users"
add_foreign_key "learning_minute_statistics", "practices"
Expand Down
1 change: 1 addition & 0 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
events
external_entries
faqs
faqs_categories
followings
reports
learning_times
Expand Down

0 comments on commit a879736

Please sign in to comment.