Class: Moxie::TopicsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Moxie::TopicsController
- Defined in:
- app/controllers/moxie/topics_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/moxie/topics_controller.rb', line 37 def create topic_params = params[:moxie_topic] topic_params[:author_id] = current_user.id topic_params[:posts_attributes]['0'][:author_id] = current_user.id @topic = Topic.new( topic_params ) @forum = Forum.find( params[:moxie_topic][:forum_id] ) respond_to do |format| if @topic.save format.html { redirect_to( moxie_forum_path( @topic.forum ), :notice => 'Topic was successfully created.') } else format.html { render :new } end end end |
#new ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/moxie/topics_controller.rb', line 26 def new @topic = Topic.new @topic.posts.build @forum = Forum.find( params[:forum_id] ) respond_to do |format| format.html # new.html.erb format.xml { render :xml => @topic } end end |