Class: FastExt::MMenusController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #paginate

Instance Method Details

#createObject



29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/fast_ext/m_menus_controller.rb', line 29

def create
  @m_menu = MMenu.new(m_menu_params)
  respond_with(@m_menu) do |format|
    if @m_menu.save
      format.json { render :json => {:success => true, :msg => 'ok'} }
    else
      format.json { render :json => {:success => false, :msg => 'failure'} }
    end
  end

end

#destroyObject



53
54
55
56
57
# File 'app/controllers/fast_ext/m_menus_controller.rb', line 53

def destroy
  #@m_menu = MMenu.find(params[:id])
  @m_menu.destroy
  respond_with(@m_menu)
end

#editObject



19
20
21
22
# File 'app/controllers/fast_ext/m_menus_controller.rb', line 19

def edit
  #@m_menu = MMenu.find(params[:id])
  respond_with(@m_menu.to_json(:include => [:createdbyorg, :createdby, :updatedby]))
end

#indexObject



8
9
10
11
12
# File 'app/controllers/fast_ext/m_menus_controller.rb', line 8

def index
  @m_menus = MMenu.all
  data = paginate(@m_menus)
  respond_with(data.to_json(:include => [:m_menu_items,:createdbyorg, :createdby, :updatedby]))
end

#newObject



24
25
26
27
# File 'app/controllers/fast_ext/m_menus_controller.rb', line 24

def new
  @m_menu = MMenu.new
  respond_with(@m_menu)
end

#showObject



14
15
16
17
# File 'app/controllers/fast_ext/m_menus_controller.rb', line 14

def show
  #@m_menu = MMenu.find(params[:id])
  respond_with(@m_menu)
end

#updateObject



41
42
43
44
45
46
47
48
49
50
51
# File 'app/controllers/fast_ext/m_menus_controller.rb', line 41

def update
  #@m_menu = MMenu.find(params[:id])

  respond_with(@m_menu) do |format|
    if @m_menu.update_attributes(m_menu_params)
      format.json { render :json => {:success => true, :msg => 'ok'} }
    else
      format.json { render :json => {:success => false, :msg => 'false'} }
    end
  end
end