Class: FastExt::MRolesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- FastExt::MRolesController
- Defined in:
- app/controllers/fast_ext/m_roles_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
30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/fast_ext/m_roles_controller.rb', line 30 def create @m_role = MRole.new(m_role_params) respond_with(@m_role) do |format| if @m_role.save format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'failure'} } end end end |
#destroy ⇒ Object
54 55 56 57 58 |
# File 'app/controllers/fast_ext/m_roles_controller.rb', line 54 def destroy @m_role = MRole.find(params[:id]) @m_role.destroy respond_with(@m_role) end |
#edit ⇒ Object
20 21 22 23 |
# File 'app/controllers/fast_ext/m_roles_controller.rb', line 20 def edit #@m_role = MRole.find(params[:id]) respond_with(@m_role.to_json({:include => :m_people,:methods => :m_person_ids})) end |
#index ⇒ Object
9 10 11 12 13 |
# File 'app/controllers/fast_ext/m_roles_controller.rb', line 9 def index @m_roles = MRole.all data = paginate(@m_roles) respond_with(data.to_json({:include => [:m_people, :m_menu],:methods => :m_person_ids})) end |
#new ⇒ Object
25 26 27 28 |
# File 'app/controllers/fast_ext/m_roles_controller.rb', line 25 def new @m_role = MRole.new respond_with(@m_role) end |
#show ⇒ Object
15 16 17 18 |
# File 'app/controllers/fast_ext/m_roles_controller.rb', line 15 def show #@m_role = MRole.find(params[:id]) respond_with(@m_role) end |
#update ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/fast_ext/m_roles_controller.rb', line 42 def update #@m_role = MRole.find(params[:id]) respond_with(@m_role) do |format| if @m_role.update_attributes(m_role_params) format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'false'} } end end end |