Class: FastExt::MListsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/fast_ext/m_lists_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_lists_controller.rb', line 29

def create
  @m_list = MList.new(m_list_params)
  respond_with(@m_list) do |format|
    if @m_list.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_lists_controller.rb', line 53

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

#editObject



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

def edit
  #@m_list = MList.find(params[:id])
  respond_with(@m_list)
end

#indexObject



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

def index
  @m_lists = MList.all
  data = paginate(@m_lists)
  respond_with(data.to_json(:include => [:m_list_items,:createdbyorg, :createdby, :updatedby]))
end

#newObject



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

def new
  @m_list = MList.new
  respond_with(@m_list)
end

#showObject



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

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

#updateObject



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

def update
  #@m_list = MList.find(params[:id])

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