Module: BeetleReporter
- Defined in:
- lib/beetle_reporter.rb,
lib/beetle_reporter/engine.rb,
lib/beetle_reporter/version.rb,
app/models/beetle_reporter/report.rb,
lib/beetle_reporter/configuration.rb,
app/helpers/beetle_reporter/home_helper.rb,
app/jobs/beetle_reporter/application_job.rb,
app/helpers/beetle_reporter/reports_helper.rb,
app/models/beetle_reporter/application_record.rb,
app/helpers/beetle_reporter/application_helper.rb,
app/mailers/beetle_reporter/application_mailer.rb,
app/controllers/beetle_reporter/home_controller.rb,
app/controllers/beetle_reporter/reports_controller.rb,
app/controllers/beetle_reporter/application_controller.rb
Defined Under Namespace
Modules: ApplicationHelper, HomeHelper, ReportsHelper
Classes: ApplicationController, ApplicationJob, ApplicationMailer, ApplicationRecord, Configuration, Engine, HomeController, Report, ReportsController
Constant Summary
collapse
- VERSION =
'0.1.10'
Class Method Summary
collapse
Class Method Details
.add(record, user_id, reason) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/beetle_reporter.rb', line 30
def add(record, user_id, reason)
report = BeetleReporter::Report.pending.kept.find_by(record: record)
if report
report.user_ids << user_id unless report.user_ids.include?(user_id)
report.reasons << reason unless report.reasons.include?(reason)
report.reported_count += 1
report.user_ids = report.user_ids.uniq
report.reasons = report.reasons.uniq
report.save
else
report = BeetleReporter::Report.create(record: record,
user_ids: [user_id],
reasons: [reason],
reported_count: 1,
)
end
report
end
|
.config ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/beetle_reporter.rb', line 13
def config
return @config if defined?(@config)
@config = Configuration.new
@config.user_class = 'User'
@config.current_user_method = 'current_user'
@config.user_name_method = 'name'
@config.main_app_root_path_method = 'root_path'
@config.main_app_user_path_method = 'user_path'
@config
end
|
26
27
28
|
# File 'lib/beetle_reporter.rb', line 26
def configure
yield(config)
end
|