Sha256: 93e11fd7e2f9155c19c5c0c90043a1e6a00b26d0519a3c70a1c3dbfe1e952b04
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
class RailsDetailAdmin::ListsController < RailsDetailAdmin::BaseController before_action :set_list, only: [:edit, :update, :destroy] def index @lists = List.page(params[:page]) end def new @list = List.new end def create @list = List.new list_params respond_to do |format| if @list.save format.html { redirect_to admin_lists_url notice: 'Item type was successfully created.' } format.json { render json: @list, status: :created, location: @list } else format.html { render action: "new" } format.json { render json: @list.errors, status: :unprocessable_entity } end end end def edit end def update respond_to do |format| if @list.update list_params format.html { redirect_to admin_lists_url, notice: 'Item type was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @list.errors, status: :unprocessable_entity } end end end def destroy @list.destroy respond_to do |format| format.html { redirect_to admin_lists_url } format.json { head :no_content } end end private def set_list @list = List.find params[:id] end def list_params params.fetch(:list, {}).permit(:name, :kind) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_detail-0.0.1 | app/controllers/rails_detail_admin/lists_controller.rb |