Class: FastExt::MPersonRolesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- FastExt::MPersonRolesController
- Defined in:
- app/controllers/fast_ext/m_person_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
32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/fast_ext/m_person_roles_controller.rb', line 32 def create @m_person_role = MPersonRole.new(m_person_role_params) respond_with(@m_person_role) do |format| if @m_person_role.save format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'failure'} } end end end |
#destroy ⇒ Object
55 56 57 58 59 |
# File 'app/controllers/fast_ext/m_person_roles_controller.rb', line 55 def destroy #@m_person_role = MPersonRole.find(params[:id]) @m_person_role.destroy respond_with(@m_person_role) end |
#edit ⇒ Object
22 23 24 25 |
# File 'app/controllers/fast_ext/m_person_roles_controller.rb', line 22 def edit #@m_person_role = MPersonRole.find(params[:id]) respond_with(@m_person_role.to_json({:include => [:m_person, :m_role]})) end |
#index ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/controllers/fast_ext/m_person_roles_controller.rb', line 9 def index @m_person_roles = MPersonRole.where({ :m_role_id => params[:m_role_id] }.delete_if {|k, v| v.blank? }) data = paginate(@m_person_roles) respond_with(data.to_json({:include => [:m_person, :m_role]})) end |
#new ⇒ Object
27 28 29 30 |
# File 'app/controllers/fast_ext/m_person_roles_controller.rb', line 27 def new @m_person_role = MPersonRole.new respond_with(@m_person_role) end |
#show ⇒ Object
17 18 19 20 |
# File 'app/controllers/fast_ext/m_person_roles_controller.rb', line 17 def show #@m_person_role = MPersonRole.find(params[:id]) respond_with(@m_person_role) end |
#update ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/fast_ext/m_person_roles_controller.rb', line 44 def update #@m_person_role = MPersonRole.find(params[:id]) respond_with(@m_person_role) do |format| if @m_person_role.update_attributes(m_person_role_params) format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'false'} } end end end |