You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/controllers/item_banks_controller.rb

21 lines
533 B

5 years ago
class ItemBanksController < ApplicationController
5 years ago
include PaginateHelper
5 years ago
before_action :require_login
5 years ago
def index
5 years ago
items = ItemBankQuery.call(params)
@items_count = items.size
@items = paginate items.includes(:item_analysis, :user)
5 years ago
end
def create
5 years ago
item = ItemBank.new(user: current_user)
ItemBank::SaveItemService.call(item, form_params)
end
5 years ago
5 years ago
private
def form_params
params.permit(:repertoire_id, :sub_repertoire_id, :item_type, :difficulty, :name, tag_repertoire_id: [], choices: [])
5 years ago
end
5 years ago
end