Class: SuggestedEdit
Instance Method Summary
collapse
#max_edit_comment_length
#maximum_tag_length, #maximum_tags, #maximum_title_length, #no_spaces_in_tags, #required_tags?, #stripped_minimum_body, #stripped_minimum_title, #tags_in_tag_set
#attributes_print, fuzzy_search, match_search, #match_search, sanitize_for_search, sanitize_name, sanitize_sql_in, useful_err_msg, with_lax_group_rules
Instance Method Details
#approved? ⇒ Boolean
28
29
30
|
# File 'app/models/suggested_edit.rb', line 28
def approved?
!active && accepted
end
|
#clear_pending_cache ⇒ Object
20
21
22
|
# File 'app/models/suggested_edit.rb', line 20
def clear_pending_cache
Rails.cache.delete "pending_suggestions/#{post.category_id}"
end
|
#on_article? ⇒ Boolean
40
41
42
|
# File 'app/models/suggested_edit.rb', line 40
def on_article?
post.article?
end
|
#on_question? ⇒ Boolean
36
37
38
|
# File 'app/models/suggested_edit.rb', line 36
def on_question?
post.question?
end
|
#pending? ⇒ Boolean
24
25
26
|
# File 'app/models/suggested_edit.rb', line 24
def pending?
active
end
|
#rejected? ⇒ Boolean
32
33
34
|
# File 'app/models/suggested_edit.rb', line 32
def rejected?
!active && !accepted
end
|
#update_tag_associations ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'app/models/suggested_edit.rb', line 46
def update_tag_associations
return if tags_cache.nil?
tags_cache.each do |tag_name|
tag = Tag.find_or_create_by name: tag_name, tag_set: post.category.tag_set
unless tags.include? tag
tags << tag
end
end
tags.each do |tag|
unless tags_cache.include? tag.name
tags.delete tag
end
end
end
|