user_actions_logger 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9955ea816def52296a19140496e3727474497d1eb923afea5312dcc0632d1a8c
4
+ data.tar.gz: 7bd0b96ac465669596801d505f308a1f25b701722fa94e85abb349217dcad4ee
5
+ SHA512:
6
+ metadata.gz: d691a2e481019b3ab7e2c0a48edda6d9a94579f81c70f500e1dd6f5015adcc56ad811b52b165dc220a713817fe7cabbb80aa1e84994906ad34f9de3a8b70e611
7
+ data.tar.gz: b354b81abf2d666461749580c709eb728a63213597f6c5228ba83c0afd076e4d253a27ff948ef144b7c6e9fe17dea30c97850da8aa6a5948bd4c1e7c01890c1b
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ usage.rb
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ # Gemfile
2
+ source 'https://rubygems.org'
3
+ ruby '2.3.3'
data/README.md ADDED
@@ -0,0 +1 @@
1
+ init gem
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UserActionsLogger
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ before_action :create_log, only: :destroy
8
+ after_action :create_log, only: %i[update create]
9
+ end
10
+
11
+ def watch_for
12
+ 'override this method(watch_for) in you controller. Read the doc!'
13
+ end
14
+
15
+ def who_did_it
16
+ current_user.to_json
17
+ end
18
+
19
+ def where_did
20
+ controller_name.classify
21
+ end
22
+
23
+ def what_did
24
+ params[:action]
25
+ end
26
+
27
+ private
28
+
29
+ def create_log
30
+ log = Logging.new
31
+ log.user = who_did_it
32
+ log.object = watch_for.to_json
33
+ log.action = what_did
34
+ log.module_name = where_did
35
+ log.save
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: user_actions_logger
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Yurich May
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-04-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Logging user actions in loggings table if you use SQL. But you can use
14
+ this gem whith no-sql db
15
+ email: yurich.maevskiy@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - Gemfile
22
+ - README.md
23
+ - lib/user_actions_logger.rb
24
+ homepage: https://github.com/AveYurich/user_actions_logger
25
+ licenses:
26
+ - MIT
27
+ metadata: {}
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 2.7.4
45
+ signing_key:
46
+ specification_version: 4
47
+ summary: UserAsctionLogger - Simple gem for loggin user actions
48
+ test_files: []