Sha256: 45816e13f9102b5f777fafbaedf44260c2424ebe265e8d1542933f9cba518dd1
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
module Rapidfire class QuestionGroupsController < Rapidfire::ApplicationController before_filter :authenticate_administrator!, except: :index respond_to :html, :js respond_to :json, only: :results def index @question_groups = QuestionGroup.all respond_with(@question_groups) end def new @question_group = QuestionGroup.new respond_with(@question_group) end def create @question_group = QuestionGroup.new(question_group_params) @question_group.save respond_with(@question_group, location: rapidfire.question_groups_url) end def destroy @question_group = QuestionGroup.find(params[:id]) @question_group.destroy respond_with(@question_group) end def results @question_group = QuestionGroup.find(params[:id]) @question_group_results = QuestionGroupResults.new(question_group: @question_group).extract respond_with(@question_group_results, root: false) end private def question_group_params if Rails::VERSION::MAJOR == 4 params.require(:question_group).permit(:name) else params[:question_group] end end end end
Version data entries
3 entries across 3 versions & 2 rubygems