Class: Forem::TopicsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Forem::TopicsController
- Defined in:
- app/controllers/forem/topics_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 |
# File 'app/controllers/forem/topics_controller.rb', line 16 def create params[:topic].merge!(:user => current_user) @topic = Forem::Topic.create(params[:topic]) flash[:notice] = "Topic has been created!" redirect_to @topic end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/forem/topics_controller.rb', line 7 def index @topics = Forem::Topic.all end |
#new ⇒ Object
11 12 13 14 |
# File 'app/controllers/forem/topics_controller.rb', line 11 def new @topic = Forem::Topic.new @topic.posts.build end |
#show ⇒ Object
23 24 25 |
# File 'app/controllers/forem/topics_controller.rb', line 23 def show @topic = Forem::Topic.find(params[:id]) end |