activitylog 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmFhNGFkYTZkOTY0YTBlZDhjYjk1NTk2NDU0OGVkMTFiZGM4ZjA3Yg==
4
+ MDU3NTY3MmYyNmUwNTFlOWM4NjhmYzM4NDY1NGNlZmFjNjdjYzE4Nw==
5
5
  data.tar.gz: !binary |-
6
- MWIwYmU3MDI3MDBhYTJkYzcyZGU5Y2ZiZTBhOWMyZTg2ZjI0ZjZlYw==
7
- !binary "U0hBNTEy":
6
+ MWM2MjZlOTVlNDU1ZWMyMDdkMDgyMjA3M2NjZDk4ZGYzNTg1YzQ5Mw==
7
+ SHA512:
8
8
  metadata.gz: !binary |-
9
- ZWIzZDFkYjRhMzhiMmUyNDNlMTU2NTcwMDIzMGZkMThlYjA4ODRlMDJiOTVi
10
- ZWU2Y2JkOTE5NzJhYzIyNWM2OGE1NjU1NTYzMGI3NTEyNzYzMDk0MzhiYjI4
11
- MzliN2IxMGVlNzY2YThlMjFmMGEzNjJiNTNhNzQwOGVhZWZlMmY=
9
+ NmQ1NGRiMDY2YzZiZmQ0MzRhYzM2OThkNDcxNzdmNWRkM2QwN2UzNTI3NGJl
10
+ MTdkNGY5ODQ5ZjZjNGZmZjY1Y2NlZjdjYmUwOWFhZjI0ZWIxYTg1ODAxNjY3
11
+ ZjYyMjc5ZjZlZjRiOTIzZDJjMjI0MDA2ZmVlYjZmZGQ5MjFmNjY=
12
12
  data.tar.gz: !binary |-
13
- ZTk5MTE2NDkwZjJlMzRmMTM0NjY0M2IwZmJmMTk1OWZjMWYzMGMxMzI5N2Mz
14
- NjI1NmFjNmMwZTljMTg5NzY3MDM4Y2NhOWJhMzU0NjhiNTIwM2YxMWQ4Njkw
15
- OTRhNzViODdhZjUwMzlmYjZkYTRkZmJlMjE2NmU1ZWQwNDBlZDU=
13
+ YWNjZWY1N2U1MzU1M2YxM2RhZDdjZGRhMGQ1ZDIxMTQzZGJiNDE2NmRmMDQx
14
+ Y2Y0MDgzYTAwZTg4YzdmODIxNDA0MjRhNzU4MzJkYWJlZGQ0MTJiNTZlMTdi
15
+ YWQ3ZDhmYmFiMjY5ZTdiYjI0NGJiMGNlZGRmNzFmZjc4M2NhMTg=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.0
1
+ 1.6.0
data/activitylog.gemspec CHANGED
@@ -2,14 +2,15 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: activitylog 1.6.0 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "activitylog"
8
- s.version = "1.5.0"
9
+ s.version = "1.6.0"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
12
  s.authors = ["Jon Erik Suero", "Elan Dubrofsky"]
12
- s.date = "2013-10-17"
13
+ s.date = "2013-11-11"
13
14
  s.description = "Coming soon"
14
15
  s.email = "jonerikdsuero@gmail.com"
15
16
  s.extra_rdoc_files = [
@@ -38,7 +39,7 @@ Gem::Specification.new do |s|
38
39
  s.homepage = "http://github.com/JonErikDSuero/activitylog"
39
40
  s.licenses = ["MIT"]
40
41
  s.require_paths = ["lib"]
41
- s.rubygems_version = "2.0.5"
42
+ s.rubygems_version = "2.1.10"
42
43
  s.summary = "Provides Activity Log functionality to your code"
43
44
 
44
45
  if s.respond_to? :specification_version then
@@ -3,14 +3,14 @@ require 'activity_log/model_activity_logger'
3
3
  module ControllerActivityLogger
4
4
  extend ActiveSupport::Concern
5
5
 
6
- def clear_parent_activity_id
6
+ def clear_parent_activity_id(options = {})
7
7
  ModelActivityLogger.current_parent_activity_id = nil
8
8
  end
9
9
 
10
- def record_activity_log
11
- return unless params[:id].present?
10
+ def record_activity_log(options = {})
11
+ return unless params[options[:key] || :id].present?
12
12
  return if request.get? #exit if it's a get
13
- object = controller_name.classify.constantize.find_by_id(params[:id])
13
+ object = (options[:class] || controller_name).classify.constantize.find_by_id(params[options[:key] || :id])
14
14
  return unless object.present?
15
15
  return unless object.respond_to? :activity_logs
16
16
  ModelActivityLogger.current_parent_activity_id = object.activity_logs.create(user_id: current_user.try(:id), action: "#{params[:controller]}/#{params[:action]}", data: params, action_type: 'controller').id
@@ -19,8 +19,8 @@ module ControllerActivityLogger
19
19
  # CLASS METHODS (self.)
20
20
  module ClassMethods
21
21
  def log_activity(options = {})
22
- send :before_filter, :record_activity_log, options
23
- send :after_filter, :clear_parent_activity_id, options
22
+ self.before_filter {record_activity_log(options)}
23
+ self.after_filter {clear_parent_activity_id(options)}
24
24
  end
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activitylog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Erik Suero
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-17 00:00:00.000000000 Z
12
+ date: 2013-11-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shoulda
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 2.0.5
101
+ rubygems_version: 2.1.10
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Provides Activity Log functionality to your code