Class: CommentsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- CommentsController
- Defined in:
- lib/generators/squeezer/templates/app/controllers/comments_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#close ⇒ Object
16 17 18 19 20 21 |
# File 'lib/generators/squeezer/templates/app/controllers/comments_controller.rb', line 16 def close @comment = Comment.find(params[:id]) @comment.open = false @comment.save redirect_to :back end |
#new ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/generators/squeezer/templates/app/controllers/comments_controller.rb', line 23 def new @comment = Comment.new @comment.commentable_id = params[:id] @comment.open = true @comment.commentable_type = params[:type] @comment.save redirect_to :back end |
#open ⇒ Object
9 10 11 12 13 14 |
# File 'lib/generators/squeezer/templates/app/controllers/comments_controller.rb', line 9 def open @comment = Comment.find(params[:id]) @comment.open=1 @comment.save redirect_to :back end |
#remove ⇒ Object
32 33 34 35 36 |
# File 'lib/generators/squeezer/templates/app/controllers/comments_controller.rb', line 32 def remove @comment = Comment.find(params[:id]) @comment.destroy redirect_to :back end |
#show ⇒ Object
4 5 6 7 |
# File 'lib/generators/squeezer/templates/app/controllers/comments_controller.rb', line 4 def show time = Time.at(params[:after].to_i + 1) @post = Post.where("comment_id = ? and created_at > ?",@comment.id,time) end |