Sha256: 0a7c936c4fc583a05484baa0c60e85eb0a02e0b7c166817b10454cd440fcb5d3
Contents?: true
Size: 1.41 KB
Versions: 6
Compression:
Stored size: 1.41 KB
Contents
require_dependency "fastui/application_controller" module Fastui class MListsController < ApplicationController respond_to :html, :xml, :json def index @m_lists = MList.scoped data = paginate(@m_lists) respond_with(data.to_json(:include => [:m_list_items,:createdbyorg, :createdby, :updatedby])) end def show @m_list = MList.find(params[:id]) respond_with(@m_list) end def edit @m_list = MList.find(params[:id]) respond_with(@m_list) end def new @m_list = MList.new respond_with(@m_list) end def create @m_list = MList.new(params[:m_list]) respond_with(@m_list) do |format| if @m_list.save format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'failure'} } end end end def update @m_list = MList.find(params[:id]) respond_with(@m_list) do |format| if @m_list.update_attributes(params[:m_list]) format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'false'} } end end end def destroy @m_list = MList.find(params[:id]) @m_list.destroy respond_with(@m_list) end end end
Version data entries
6 entries across 6 versions & 1 rubygems