-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
62 changed files
with
1,074 additions
and
359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
# ignore migration files | ||
|
||
AllCops: | ||
DisabledByDefault: false | ||
Exclude: | ||
- 'db/**/*' | ||
- 'config/**/*' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
# AboutController | ||
class AboutController < ApplicationController | ||
def index; end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# frozen_string_literal: true | ||
|
||
class SurveyQuestionsController < ApplicationController | ||
before_action :set_survey_question, only: %i[show edit update destroy] | ||
|
||
# GET /survey_questions or /survey_questions.json | ||
def index | ||
@survey_questions = SurveyQuestion.all | ||
end | ||
|
||
# GET /survey_questions/1 or /survey_questions/1.json | ||
def show; end | ||
|
||
# GET /survey_questions/new | ||
def new | ||
@survey_question = SurveyQuestion.new | ||
end | ||
|
||
# GET /survey_questions/1/edit | ||
def edit; end | ||
|
||
# POST /survey_questions or /survey_questions.json | ||
def create | ||
@survey_question = SurveyQuestion.new(survey_question_params) | ||
|
||
respond_to do |format| | ||
if @survey_question.save | ||
format.html { redirect_to survey_question_url(@survey_question), notice: 'Survey question was successfully created.' } | ||
format.json { render :show, status: :created, location: @survey_question } | ||
else | ||
format.html { render :new, status: :unprocessable_entity } | ||
format.json { render json: @survey_question.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /survey_questions/1 or /survey_questions/1.json | ||
def update | ||
respond_to do |format| | ||
if @survey_question.update(survey_question_params) | ||
format.html { redirect_to survey_question_url(@survey_question), notice: 'Survey question was successfully updated.' } | ||
format.json { render :show, status: :ok, location: @survey_question } | ||
else | ||
format.html { render :edit, status: :unprocessable_entity } | ||
format.json { render json: @survey_question.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /survey_questions/1 or /survey_questions/1.json | ||
def destroy | ||
@survey_question.destroy! | ||
|
||
respond_to do |format| | ||
format.html { redirect_to survey_questions_url, notice: 'Survey question was successfully destroyed.' } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
|
||
# Use callbacks to share common setup or constraints between actions. | ||
def set_survey_question | ||
@survey_question = SurveyQuestion.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def survey_question_params | ||
params.require(:survey_question).permit(:text, :explanation, :section) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,7 @@ def greeting_message | |
'Good afternoon!' | ||
when 18..23, 0..4 | ||
'Good evening!' | ||
else | ||
'Hello!' | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
module SurveyQuestionsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
# rubocop:disable Style/Documentation | ||
|
||
# ApplicationMailer | ||
class ApplicationMailer < ActionMailer::Base | ||
default from: '[email protected]' | ||
layout 'mailer' | ||
end | ||
# rubocop:enable Style/Documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
class SurveyAnswer < ApplicationRecord | ||
belongs_to :question, | ||
class_name: 'SurveyQuestion' | ||
|
||
belongs_to :response, | ||
class_name: 'SurveyResponse' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
class SurveyProfile < ApplicationRecord | ||
has_many :responses, | ||
foreign_key: :profile_id, | ||
class_name: 'SurveyResponse', | ||
dependent: :destroy | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class SurveyQuestion < ApplicationRecord | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
class SurveyResponse < ApplicationRecord | ||
has_many :answers, | ||
foreign_key: :response_id, | ||
class_name: 'SurveyAnswer', | ||
dependent: :delete_all | ||
|
||
validates_associated :answers | ||
|
||
has_many :questions, | ||
class_name: 'SurveyQuestion', | ||
through: :answers | ||
|
||
belongs_to :profile, | ||
class_name: 'SurveyProfile' | ||
end |
Oops, something went wrong.