Class: ForumsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ForumsController
- Defined in:
- lib/generators/squeezer/templates/app/controllers/forums_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/generators/squeezer/templates/app/controllers/forums_controller.rb', line 15 def create if @forum.save flash[:notice] = "Successfully created forum." redirect_to @forum else render :action => 'new' end end |
#destroy ⇒ Object
36 37 38 39 40 41 |
# File 'lib/generators/squeezer/templates/app/controllers/forums_controller.rb', line 36 def destroy @forum = Forum.find(params[:id]) @forum.destroy flash[:notice] = "Successfully destroyed forum." redirect_to forums_url end |
#edit ⇒ Object
24 25 |
# File 'lib/generators/squeezer/templates/app/controllers/forums_controller.rb', line 24 def edit end |
#index ⇒ Object
3 4 5 |
# File 'lib/generators/squeezer/templates/app/controllers/forums_controller.rb', line 3 def index @forums = Forum.all end |
#new ⇒ Object
12 13 |
# File 'lib/generators/squeezer/templates/app/controllers/forums_controller.rb', line 12 def new end |
#show ⇒ Object
7 8 9 10 |
# File 'lib/generators/squeezer/templates/app/controllers/forums_controller.rb', line 7 def show search = Topic.search(params[:search]).forum_id_equals(@forum.id) @topics = search.all.paginate(:per_page => 20, :page => params[:page]) end |
#update ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/generators/squeezer/templates/app/controllers/forums_controller.rb', line 27 def update if @forum.update_attributes(params[:forum]) flash[:notice] = "Successfully updated forum." redirect_to @forum else render :action => 'edit' end end |