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
19
20
21
22
23
|
# File 'app/controllers/comments_controller.rb', line 6
def create
options = .merge .to_h
= @article.(options)
unless current_user.nil? || session[:user_id].nil?
.user_id = current_user.id if current_user.id == session[:user_id]
end
remember_author_info_for
partial = "/articles/comment_failed"
partial = "/articles/comment" if recaptcha_ok_for?() && .save
respond_to do |format|
format.js { render partial }
format.html { redirect_to URI.parse(@article.permalink_url).path }
end
end
|
#preview ⇒ Object
25
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/comments_controller.rb', line 25
def preview
return render plain: "Comments are closed" if @article.
if [:body].blank?
head :ok
return
end
= @article..build()
end
|