Class: FastExt::MRolesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #paginate

Instance Method Details

#createObject



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

#destroyObject



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

#editObject



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

#indexObject



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

#newObject



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

#showObject



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

#updateObject



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