Class: PostsController
- Inherits:
-
InheritedResources::Base
- Object
- InheritedResources::Base
- PostsController
- Defined in:
- lib/generators/squeezer/templates/app/controllers/posts_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/generators/squeezer/templates/app/controllers/posts_controller.rb', line 8 def create @post = Post.new(params[:post]) @post.user =current_user if @post.save redirect_to(@post.comment.commentable, :notice => 'Post was successfully created.') else redirect_to :back flash[:error]="Completa todos los datos" end end |
#destroy ⇒ Object
19 20 21 22 |
# File 'lib/generators/squeezer/templates/app/controllers/posts_controller.rb', line 19 def destroy @post.destroy redirect_to @post.comment.commentable end |
#edit ⇒ Object
4 5 6 7 |
# File 'lib/generators/squeezer/templates/app/controllers/posts_controller.rb', line 4 def edit @post = Post.find(params[:id]) render "comments/edit" end |