Class: Moxie::PostsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Moxie::PostsController
- Defined in:
- app/controllers/moxie/posts_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/moxie/posts_controller.rb', line 27 def create post_params = params[:moxie_post] post_params[:author_id] = current_user.id @post = Post.new( post_params ) if @post.save notice = 'Post was successfully created.' else notice = 'Post was not created.' end redirect_to moxie_topic_path( @post.topic ), :notice => notice end |
#new ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/controllers/moxie/posts_controller.rb', line 18 def new @post = Post.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @post } end end |
#show ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'app/controllers/moxie/posts_controller.rb', line 9 def show @post = Post.find( params[:id] ) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @post } end end |