Class: Fastui::MListsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/fastui/m_lists_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#paginate

Instance Method Details

#createObject



27
28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/fastui/m_lists_controller.rb', line 27

def create
  @m_list = MList.new(params[:m_list])
  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



51
52
53
54
55
# File 'app/controllers/fastui/m_lists_controller.rb', line 51

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

#editObject



17
18
19
20
# File 'app/controllers/fastui/m_lists_controller.rb', line 17

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

#indexObject



6
7
8
9
10
# File 'app/controllers/fastui/m_lists_controller.rb', line 6

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

#newObject



22
23
24
25
# File 'app/controllers/fastui/m_lists_controller.rb', line 22

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

#showObject



12
13
14
15
# File 'app/controllers/fastui/m_lists_controller.rb', line 12

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

#updateObject



39
40
41
42
43
44
45
46
47
48
49
# File 'app/controllers/fastui/m_lists_controller.rb', line 39

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

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