Class: FastExt::MOrgsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- FastExt::MOrgsController
- Defined in:
- app/controllers/fast_ext/m_orgs_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
33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/fast_ext/m_orgs_controller.rb', line 33 def create @m_org = MOrg.new(m_org_params) respond_with(@m_org) do |format| if @m_org.save format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'failure'} } end end end |
#destroy ⇒ Object
57 58 59 60 61 |
# File 'app/controllers/fast_ext/m_orgs_controller.rb', line 57 def destroy #@m_org = MOrg.find(params[:id]) @m_org.destroy respond_with(@m_org) end |
#edit ⇒ Object
23 24 25 26 |
# File 'app/controllers/fast_ext/m_orgs_controller.rb', line 23 def edit #@m_org = MOrg.find(params[:id]) respond_with(@m_org.to_json(:include => [:parent])) end |
#index ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'app/controllers/fast_ext/m_orgs_controller.rb', line 9 def index #@m_orgs = MOrg.scoped @m_orgs = params[:node] == '' ? MOrg.roots : MOrg.where({ :parent_id => params[:node] }.delete_if { |k, v| v.blank? }) respond_with(@m_orgs.to_json(:include => [:parent], :methods => [:leaf, :expanded])) end |
#new ⇒ Object
28 29 30 31 |
# File 'app/controllers/fast_ext/m_orgs_controller.rb', line 28 def new @m_org = MOrg.new respond_with(@m_org) end |
#show ⇒ Object
18 19 20 21 |
# File 'app/controllers/fast_ext/m_orgs_controller.rb', line 18 def show #@m_org = MOrg.find(params[:id]) respond_with(@m_org) end |
#update ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/fast_ext/m_orgs_controller.rb', line 45 def update #@m_org = MOrg.find(params[:id]) respond_with(@m_org) do |format| if @m_org.update_attributes(m_org_params) format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'false'} } end end end |