Class: CommentsController
Instance Method Summary
collapse
Methods included from BlogHelper
#blog_base_url, #this_blog
Instance Method Details
#create ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/controllers/comments_controller.rb', line 6
def create
options = .merge .to_h
@comment = @article.(options)
remember_author_info_for @comment
partial = "/articles/comment_failed"
partial = "/articles/comment" if recaptcha_ok_for?(@comment) && @comment.save
respond_to do |format|
format.js { render partial }
format.html { redirect_to URI.parse(@article.permalink_url).path }
end
end
|
#preview ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/comments_controller.rb', line 20
def preview
return render plain: "Comments are closed" if @article.
if [:body].blank?
head :ok
return
end
@comment = @article..build()
end
|