Class: FastExt::MPersonRolesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/fast_ext/m_person_roles_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #paginate

Instance Method Details

#createObject



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

#destroyObject



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

#editObject



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

#indexObject



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

#newObject



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

#showObject



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

#updateObject



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