4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/controllers/c80_news_tz/comments_controller.rb', line 4
def create
mark_spam = false
time_delta = 0
user = User.find(params[:comment][:user_id])
unless user..nil?
time_delta = Time.now.to_i - user.
mark_spam = time_delta < 30
end
if mark_spam
respond_to do |format|
@time_elapsed = 30 - time_delta
format.js { render :action => 'antispam' }
end
else
@comment = Comment.create()
if @comment.save
(user)
@comments_count = @comment.blurb_or_fact..count
respond_to do |format|
format.js { render :action => 'created'}
end
else
respond_to do |format|
format.js { render :json => @comment.errors }
end
end
end
end
|