Sha256: d21dc6898b854102498e74fe7380800d5b0d841223a1e21dca48474076494f01
Contents?: true
Size: 1.05 KB
Versions: 223
Compression:
Stored size: 1.05 KB
Contents
require_dependency "educode_sales/application_controller" module EducodeSales class CommonsController < ApplicationController def index respond_to do |format| format.html do end format.json do @commons = Common.group("clazz").page(params[:page]).per(params[:limit]) end end end def create common = Common.new(name: params[:name], clazz: params[:clazz]) if common.save render_success else render_failure common end end def edit @common = Common.find(params[:id]) render layout: false end def update common = Common.find(params[:id]) if common.update(common_params) render_success else render_failure common end end def new render layout: false end def show commons = Common.find(params[:id]) @commons = Common.where(clazz: commons.clazz).order('position') end private def common_params params.permit(:name, :position) end end end
Version data entries
223 entries across 223 versions & 1 rubygems