Class: Admin::ForumsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/moxie/admin/forums_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/moxie/admin/forums_controller.rb', line 37

def create
  @forum = Forum.new(params[:moxie_forum])

  respond_to do |format|
    if @forum.save
      format.html { redirect_to( moxie_admin_forums_path, 
                            :notice => 'Forum was successfully created.') }
    else
      format.html { render :action => "new" }
    end
  end
end

#destroyObject



62
63
64
65
66
67
68
69
# File 'app/controllers/moxie/admin/forums_controller.rb', line 62

def destroy
  @forum = Forum.find(params[:id])
  @forum.destroy

  respond_to do |format|
    format.html { redirect_to( moxie_admin_forums_path ) }
  end
end

#editObject



33
34
35
# File 'app/controllers/moxie/admin/forums_controller.rb', line 33

def edit
  @forum = Forum.find(params[:id])
end

#indexObject



6
7
8
9
10
11
12
13
# File 'app/controllers/moxie/admin/forums_controller.rb', line 6

def index
  @forums = Forum.all

  respond_to do |format|
    format.html # index.html.erb
    format.xml  { render :xml => @forums }
  end
end

#newObject



24
25
26
27
28
29
30
31
# File 'app/controllers/moxie/admin/forums_controller.rb', line 24

def new
  @forum = Forum.new

  respond_to do |format|
    format.html # new.html.erb
    format.xml  { render :xml => @forum }
  end
end

#showObject



15
16
17
18
19
20
21
22
# File 'app/controllers/moxie/admin/forums_controller.rb', line 15

def show
  @forum = Forum.find(params[:id])

  respond_to do |format|
    format.html # show.html.erb
    format.xml  { render :xml => @forum }
  end
end

#updateObject



50
51
52
53
54
55
56
57
58
59
60
# File 'app/controllers/moxie/admin/forums_controller.rb', line 50

def update
  @forum = Forum.find(params[:id])

  respond_to do |format|
    if @forum.update_attributes(params[:moxie_forum])
      format.html { redirect_to( moxie_admin_forums_path, :notice => 'Forum was successfully updated.') }
    else
      format.html { render :action => "edit" }
    end
  end
end