class Competitions::CompetitionModulesController < Competitions::BaseController skip_before_action :require_login, only: [:index, :show] before_action :require_business, only: [:update] def index @modules = current_competition.unhidden_competition_modules.order(position: :asc) end def show @module = current_module end def update md = current_module.competition_module_md_content || current_module.build_competition_module_md_content md.name = params[:md_name] md.content = params[:md_content] md.save! render_ok end private def current_module @_current_module ||= current_competition.unhidden_competition_modules.find(params[:id]) end end