Class: ForumsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ForumsController
- Defined in:
- lib/generators/forum_monster/templates/controllers/forums_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/generators/forum_monster/templates/controllers/forums_controller.rb', line 10 def create @forum = Forum.new(params[:forum]) if @forum.save flash[:notice] = "Forum was successfully created." redirect_to forums_url else render :action => 'new' end end |
#destroy ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/generators/forum_monster/templates/controllers/forums_controller.rb', line 34 def destroy @forum = Forum.find(params[:id]) if @forum.destroy flash[:notice] = "Category was deleted." redirect_to forums_url end end |
#edit ⇒ Object
21 22 23 |
# File 'lib/generators/forum_monster/templates/controllers/forums_controller.rb', line 21 def edit @forum = Forum.find(params[:id]) end |
#new ⇒ Object
6 7 8 |
# File 'lib/generators/forum_monster/templates/controllers/forums_controller.rb', line 6 def new @forum = Forum.new end |
#show ⇒ Object
2 3 4 |
# File 'lib/generators/forum_monster/templates/controllers/forums_controller.rb', line 2 def show @forum = Forum.find(params[:id]) end |
#update ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/generators/forum_monster/templates/controllers/forums_controller.rb', line 25 def update @forum = Forum.find(params[:id]) if @forum.update_attributes(params[:forum]) flash[:notice] = "Forum was updated successfully." redirect_to forum_url(@forum) end end |