Class: FastExt::MListItemsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- FastExt::MListItemsController
- Defined in:
- app/controllers/fast_ext/m_list_items_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/fast_ext/m_list_items_controller.rb', line 35 def create @m_list_item = MListItem.new(m_list_item_params) 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 |
#destroy ⇒ Object
59 60 61 62 63 |
# File 'app/controllers/fast_ext/m_list_items_controller.rb', line 59 def destroy @m_list_item = MListItem.find(params[:id]) @m_list_item.destroy respond_with(@m_list_item) end |
#edit ⇒ Object
25 26 27 28 |
# File 'app/controllers/fast_ext/m_list_items_controller.rb', line 25 def edit #@m_list_item = MListItem.find(params[:id]) respond_with(@m_list_item.to_json(:include => [:m_list])) end |
#index ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/fast_ext/m_list_items_controller.rb', line 8 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 |
#new ⇒ Object
30 31 32 33 |
# File 'app/controllers/fast_ext/m_list_items_controller.rb', line 30 def new @m_list_item = MListItem.new respond_with(@m_list_item) end |
#show ⇒ Object
20 21 22 23 |
# File 'app/controllers/fast_ext/m_list_items_controller.rb', line 20 def show #@m_list_item = MListItem.find(params[:id]) respond_with(@m_list_item) end |
#update ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/fast_ext/m_list_items_controller.rb', line 47 def update #@m_list_item = MListItem.find(params[:id]) respond_with(@m_list_item) do |format| if @m_list_item.update_attributes(m_list_item_params) format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'false'} } end end end |