Sha256: 6f7bb46c23f6f3ad865ccf547c3eec2608048c84c09426fda3bf95015adb8a11
Contents?: true
Size: 1.01 KB
Versions: 5
Compression:
Stored size: 1.01 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") 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
5 entries across 5 versions & 1 rubygems