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