Sha256: c20ff894f73eb358ba16f08bf35b26e0e9ba183c6a413547f2b0fc9f0f9c305d
Contents?: true
Size: 1.84 KB
Versions: 2
Compression:
Stored size: 1.84 KB
Contents
require_dependency "fastui/application_controller" module Fastui class MListItemsController < ApplicationController respond_to :html, :xml, :json def index list = MList.where({ :name => params[:list_name] }.delete_if {|k, v| v.blank? }) @m_list_items = MListItem.where({ :m_list_id => params[:m_list_id] || list }.delete_if {|k, v| v.blank? }) #data = paginate(@m_list_items) respond_with(@m_list_items.to_json(:include =>[:m_list,:createdbyorg,:createdby,:updatedby])) end def show @m_list_item = MListItem.find(params[:id]) respond_with(@m_list_item) end def edit @m_list_item = MListItem.find(params[:id]) respond_with(@m_list_item) end def new @m_list_item = MListItem.new respond_with(@m_list_item) end def create @m_list_item = MListItem.new(params[:m_list_item]) respond_with(@m_list_item) do |format| if @m_list_item.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_item = MListItem.find(params[:id]) respond_with(@m_list_item) do |format| if @m_list_item.update_attributes(params[:m_list_item]) format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'false'} } end end end def destroy @m_list_item = MListItem.find(params[:id]) @m_list_item.destroy respond_with(@m_list_item) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fastui-0.1.3 | app/controllers/fastui/m_list_items_controller.rb |
fastui-0.1.2 | app/controllers/fastui/m_list_items_controller.rb |