magic_userstamp 0.1.0 → 0.1.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.
- data/README.rdoc +78 -8
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/init.rb +5 -7
- data/lib/magic_userstamp.rb +27 -0
- data/lib/{userstamp → magic_userstamp}/config.rb +11 -12
- data/lib/{userstamp → magic_userstamp}/controller.rb +2 -2
- data/lib/{userstamp → magic_userstamp}/event.rb +3 -3
- data/lib/{userstamp → magic_userstamp}/magic_columns.rb +3 -3
- data/lib/magic_userstamp/migration_helper.rb +17 -0
- data/lib/{userstamp → magic_userstamp}/stampable.rb +15 -15
- data/lib/{userstamp → magic_userstamp}/stamper.rb +5 -5
- data/magic_userstamp.gemspec +36 -29
- data/rdoc/classes/MagicUserstamp.html +233 -0
- data/rdoc/classes/MagicUserstamp/Config.html +408 -0
- data/rdoc/classes/MagicUserstamp/Config/Pattern.html +246 -0
- data/rdoc/classes/{Ddb → MagicUserstamp}/Controller.html +7 -7
- data/rdoc/classes/{Ddb/Controller/Userstamp → MagicUserstamp/Controller}/InstanceMethods.html +7 -7
- data/rdoc/classes/MagicUserstamp/Event.html +367 -0
- data/rdoc/classes/MagicUserstamp/MagicColumns.html +180 -0
- data/rdoc/classes/MagicUserstamp/MagicColumns/ClassMethods.html +225 -0
- data/rdoc/classes/MagicUserstamp/MagicUserstampError.html +111 -0
- data/rdoc/classes/{Ddb/Userstamp → MagicUserstamp}/MigrationHelper.html +8 -8
- data/rdoc/classes/MagicUserstamp/MigrationHelper/InstanceMethods.html +142 -0
- data/rdoc/classes/MagicUserstamp/Stampable.html +157 -0
- data/rdoc/classes/MagicUserstamp/Stampable/ClassMethods.html +259 -0
- data/rdoc/classes/{Ddb/Userstamp → MagicUserstamp}/Stamper.html +9 -9
- data/rdoc/classes/{Ddb/Userstamp → MagicUserstamp}/Stamper/ClassMethods.html +19 -19
- data/rdoc/classes/MagicUserstamp/Stamper/InstanceMethods.html +208 -0
- data/rdoc/created.rid +1 -1
- data/rdoc/files/README_rdoc.html +268 -0
- data/rdoc/files/lib/magic_userstamp/config_rb.html +108 -0
- data/rdoc/files/lib/magic_userstamp/controller_rb.html +108 -0
- data/rdoc/files/lib/{userstamp_rb.html → magic_userstamp/event_rb.html} +14 -7
- data/rdoc/files/lib/magic_userstamp/magic_columns_rb.html +108 -0
- data/rdoc/files/lib/{migration_helper_rb.html → magic_userstamp/migration_helper_rb.html} +12 -5
- data/rdoc/files/lib/magic_userstamp/stampable_rb.html +108 -0
- data/rdoc/files/lib/{stamper_rb.html → magic_userstamp/stamper_rb.html} +12 -5
- data/rdoc/files/lib/{stampable_rb.html → magic_userstamp_rb.html} +6 -6
- data/rdoc/fr_class_index.html +18 -13
- data/rdoc/fr_file_index.html +11 -9
- data/rdoc/fr_method_index.html +39 -9
- data/rdoc/index.html +7 -5
- data/spec/compatibility_stamping_spec.rb +3 -3
- data/spec/config_spec.rb +5 -5
- data/spec/magic_column_spec.rb +8 -8
- data/spec/resources/controllers/magic_userstamp_controller.rb +9 -0
- data/spec/resources/controllers/posts_controller.rb +2 -2
- data/spec/resources/controllers/users_controller.rb +2 -2
- data/spec/stamping_spec.rb +1 -1
- metadata +36 -29
- data/lib/userstamp.rb +0 -17
- data/lib/userstamp/migration_helper.rb +0 -17
- data/rdoc/classes/Ddb/Controller/Userstamp.html +0 -125
- data/rdoc/classes/Ddb/Userstamp.html +0 -121
- data/rdoc/classes/Ddb/Userstamp/MigrationHelper/InstanceMethods.html +0 -142
- data/rdoc/classes/Ddb/Userstamp/Stampable.html +0 -128
- data/rdoc/classes/Ddb/Userstamp/Stampable/ClassMethods.html +0 -222
- data/rdoc/classes/Ddb/Userstamp/Stamper/InstanceMethods.html +0 -207
- data/rdoc/files/CHANGELOG.html +0 -137
- data/rdoc/files/LICENSE.html +0 -129
- data/rdoc/files/README.html +0 -341
- data/spec/resources/controllers/userstamp_controller.rb +0 -9
data/README.rdoc
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
= MagicUserstamp
|
2
2
|
|
3
|
+
== About MagicUserstamp
|
4
|
+
This plugin is a fork of delynn/userstamp ( http://github.com/delynn/userstamp )
|
5
|
+
|
6
|
+
But almost of classes have been changed. And you can use creator_id, updater_id or deleter_id (with acts_as_paranod)
|
7
|
+
without definition in each model. Instead of them, you can write just config/initializers/magic_userstamp.rb .
|
8
|
+
|
3
9
|
== Install
|
4
10
|
|
5
11
|
=== as a plugin
|
@@ -17,19 +23,58 @@ Or install gem manually
|
|
17
23
|
$ sudo gem tumble
|
18
24
|
$ sudo gem install magic_userstamp
|
19
25
|
|
20
|
-
==
|
26
|
+
== Simple Configuration
|
21
27
|
make config/initializers/magic_userstamp.rb
|
22
28
|
|
23
29
|
The most simple setting
|
24
|
-
|
30
|
+
require 'magic_userstamp'
|
31
|
+
# Comment out if you don't use t.userstamp at all in migrations
|
32
|
+
ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, MagicUserstamp::MigrationHelper)
|
33
|
+
ActiveRecord::Base.module_eval do
|
34
|
+
include MagicUserstamp
|
35
|
+
end
|
36
|
+
|
37
|
+
MagicUserstamp::Config.setup.defaults
|
38
|
+
|
39
|
+
# If you have some classes which has loaded before Userstamp is loaded,
|
40
|
+
# set record_userstamp true
|
41
|
+
# Example: vestal_versions gem
|
42
|
+
# Version.record_userstamp = true if defined?(Version)
|
43
|
+
|
44
|
+
|
45
|
+
== Controller setting
|
46
|
+
|
47
|
+
add followings to ApplicationController or some controller
|
48
|
+
|
49
|
+
before_filter :set_user
|
50
|
+
after_filter :reset_user
|
51
|
+
|
52
|
+
def set_user
|
53
|
+
user_id = session[:user] # ここではIDが帰ってくるはず。
|
54
|
+
User.model_stamper # UserがIDを覚えられるようにする。
|
55
|
+
User.stamper = user_id # IDを覚えておく。stamper=にはオブジェクトを渡してもOK。
|
56
|
+
end
|
57
|
+
|
58
|
+
def reset_user
|
59
|
+
User.model_stamper # Userが覚えているIDを忘れることができるようにする。
|
60
|
+
User.reset_stamper # Userが覚えているIDを実際に忘れる。
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
== Various Configuration
|
66
|
+
If you want to customize setting, chage config/initializers/magic_userstamp.rb
|
67
|
+
|
68
|
+
The most simple setting
|
69
|
+
MagicUserstamp::Config.setup.defaults
|
25
70
|
|
26
71
|
Specify User class name
|
27
|
-
|
72
|
+
MagicUserstamp::Config.setup.defaults(:stamper_class_name => 'AdminUser')
|
28
73
|
|
29
74
|
Actually
|
30
|
-
|
75
|
+
MagicUserstamp::Config.setup.defaults
|
31
76
|
means
|
32
|
-
|
77
|
+
MagicUserstamp.config.setup do |config|
|
33
78
|
config.with_options(:stamper_class_name => 'User') do |c|
|
34
79
|
c.on(:create , :creator_id)
|
35
80
|
c.on(:update , :updater_id)
|
@@ -39,7 +84,7 @@ means
|
|
39
84
|
|
40
85
|
|
41
86
|
Specify User class name and creator/updater columns
|
42
|
-
|
87
|
+
MagicUserstamp.config.setup do |config|
|
43
88
|
config.with_options(:stamper_class_name => 'Person') do |c|
|
44
89
|
c.on(:create , :creator_person_id)
|
45
90
|
c.on(:update , :updater_person_id)
|
@@ -48,17 +93,42 @@ Specify User class name and creator/updater columns
|
|
48
93
|
end
|
49
94
|
|
50
95
|
Specify target stampable class names
|
51
|
-
|
96
|
+
MagicUserstamp.config.setup do |config|
|
52
97
|
config.defaults(:stampable_class_names => %w(Book Schedule))
|
53
98
|
|
54
99
|
Specify target stampable class names and columns
|
55
|
-
|
100
|
+
MagicUserstamp.config.setup do |config|
|
101
|
+
config.with_options(:stampable_class_names => %w(Book Schedule)) do |c|
|
102
|
+
c.on(:create , :creator_user_id)
|
103
|
+
c.on(:update , :updater_user_id)
|
104
|
+
c.on(:destroy, :deleter_user_id)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
Use in compatibility mode
|
110
|
+
MagicUserstamp.config.compatibles
|
111
|
+
|
112
|
+
Same as
|
113
|
+
MagicUserstamp.config.setup do |c|
|
114
|
+
c.on(:create , :created_by)
|
115
|
+
c.on(:update , :updated_by)
|
116
|
+
c.on(:destroy, :deleted_by)
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
Complex pattern
|
122
|
+
MagicUserstamp.config.setup do |config|
|
56
123
|
config.with_options(:stampable_class_names => %w(Book Schedule)) do |c|
|
57
124
|
c.on(:create , :creator_user_id)
|
58
125
|
c.on(:update , :updater_user_id)
|
59
126
|
c.on(:destroy, :deleter_user_id)
|
60
127
|
end
|
128
|
+
config.compatibles(:stamper_class_name => 'Person', :stampable_class_names => %w(Person Email))
|
129
|
+
config.defaults
|
61
130
|
end
|
62
131
|
|
132
|
+
|
63
133
|
-----
|
64
134
|
Copyright (c) 2009 'Takeshi AKIMA, released under the MIT license
|
data/Rakefile
CHANGED
@@ -40,6 +40,7 @@ Rake::RDocTask.new do |rdoc|
|
|
40
40
|
|
41
41
|
rdoc.rdoc_dir = 'rdoc'
|
42
42
|
rdoc.title = "magic_userstamp #{version}"
|
43
|
-
rdoc.rdoc_files.include('README
|
43
|
+
rdoc.rdoc_files.include('README.rdoc')
|
44
44
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
rdoc.options = ["--charset", "utf-8", "--line-numbers"]
|
45
46
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/init.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require '
|
2
|
+
require 'magic_userstamp'
|
3
3
|
# コントローラへは自身でincludeしてください。
|
4
|
-
# ActionController::Base.send(:include,
|
5
|
-
ActiveRecord::ConnectionAdapters::TableDefinition.send(:include,
|
4
|
+
# ActionController::Base.send(:include, MagicUserstamp::Controller) if defined?(ActionController)
|
5
|
+
ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, MagicUserstamp::MigrationHelper)
|
6
6
|
if defined?(ActiveRecord)
|
7
|
-
ActiveRecord::Base.module_eval do
|
8
|
-
include
|
9
|
-
include Userstamp::Stamper
|
10
|
-
include Userstamp::MagicColumns # mest be included after Userstamp::Stampable
|
7
|
+
ActiveRecord::Base.module_eval do
|
8
|
+
include MagicUserstamp
|
11
9
|
end
|
12
10
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
module MagicUserstamp
|
3
|
+
def self.included(mod)
|
4
|
+
if mod <= ::ActiveRecord::Base
|
5
|
+
mod.module_eval do
|
6
|
+
include MagicUserstamp::Stampable
|
7
|
+
include MagicUserstamp::Stamper
|
8
|
+
include MagicUserstamp::MagicColumns # mest be included after Userstamp::Stampable
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
autoload :Config, 'magic_userstamp/config'
|
14
|
+
autoload :Controller, 'magic_userstamp/controller'
|
15
|
+
autoload :Event, 'magic_userstamp/event'
|
16
|
+
autoload :MagicColumns, 'magic_userstamp/magic_columns'
|
17
|
+
autoload :MigrationHelper, 'magic_userstamp/migration_helper'
|
18
|
+
autoload :Stampable, 'magic_userstamp/stampable'
|
19
|
+
autoload :Stamper, 'magic_userstamp/stamper'
|
20
|
+
|
21
|
+
class MagicUserstampError < StandardError
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.config
|
25
|
+
Config.instance
|
26
|
+
end
|
27
|
+
end
|
@@ -1,23 +1,17 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require '
|
2
|
+
require 'magic_userstamp'
|
3
3
|
|
4
|
-
module
|
4
|
+
module MagicUserstamp
|
5
5
|
|
6
|
-
def self.config
|
7
|
-
Config.instance
|
8
|
-
end
|
9
|
-
|
10
6
|
class Config
|
11
7
|
|
12
8
|
class << self
|
13
9
|
def instance
|
14
|
-
@instance
|
10
|
+
@instance ||= Config.new
|
15
11
|
end
|
16
12
|
|
17
|
-
def setup
|
18
|
-
|
19
|
-
yield(@instance) if block_given?
|
20
|
-
@instance
|
13
|
+
def setup(&block)
|
14
|
+
instance.setup(&block)
|
21
15
|
end
|
22
16
|
|
23
17
|
def clear
|
@@ -34,6 +28,11 @@ module Userstamp
|
|
34
28
|
@with_destroy = defined?(Caboose::Acts::Paranoid)
|
35
29
|
end
|
36
30
|
|
31
|
+
def setup
|
32
|
+
yield(self) if block_given?
|
33
|
+
self
|
34
|
+
end
|
35
|
+
|
37
36
|
def pattern_for(klass, column_name)
|
38
37
|
patterns.detect{|pattern| pattern.stampable?(klass, column_name)}
|
39
38
|
end
|
@@ -98,7 +97,7 @@ module Userstamp
|
|
98
97
|
:stamper_attr_name => nil # sholuld not be only 'id' but PK column name
|
99
98
|
}.update(options || {})
|
100
99
|
@stampable_class_names = options.delete(:stampable_class_names)
|
101
|
-
|
100
|
+
MagicUserstamp::Stampable.raise_unless_valid_options_for_stampable_on(options)
|
102
101
|
@options_for_stampable_on = options
|
103
102
|
@stamper_class_name = options[:stamper_class_name]
|
104
103
|
@stamper_attr_name = options[:stamper_attr_name]
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require '
|
1
|
+
require 'magic_userstamp'
|
2
2
|
|
3
|
-
module
|
3
|
+
module MagicUserstamp
|
4
4
|
module Controller
|
5
5
|
# The Userstamp module, when included into a controller, adds a before filter
|
6
6
|
# (named <tt>set_stamper</tt>) and an after filter (name <tt>reset_stamper</tt>).
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require '
|
2
|
+
require 'magic_userstamp'
|
3
3
|
|
4
|
-
module
|
4
|
+
module MagicUserstamp
|
5
5
|
|
6
6
|
class Event
|
7
7
|
attr_reader :name, :actor, :actual_hook, :after_callback
|
@@ -52,7 +52,7 @@ module Userstamp
|
|
52
52
|
|
53
53
|
def raise_unless_valid_name(event_name)
|
54
54
|
return if valid_name?(event_name)
|
55
|
-
raise
|
55
|
+
raise MagicUserstampError, "Invalid event name '#{event_name.inspect}'. Event name must be one of #{valid_names.inspect}"
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require '
|
2
|
+
require 'magic_userstamp'
|
3
3
|
|
4
|
-
module
|
4
|
+
module MagicUserstamp
|
5
5
|
|
6
6
|
module MagicColumns
|
7
7
|
def self.included(mod)
|
@@ -35,7 +35,7 @@ module Userstamp
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def setup_userstamp(columns)
|
38
|
-
config =
|
38
|
+
config = MagicUserstamp.config
|
39
39
|
columns.each do |column|
|
40
40
|
next if column.primary
|
41
41
|
if pattern = config.pattern_for(self, column.name)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'magic_userstamp'
|
2
|
+
|
3
|
+
module MagicUserstamp
|
4
|
+
module MigrationHelper
|
5
|
+
def self.included(base) # :nodoc:
|
6
|
+
base.send(:include, InstanceMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
module InstanceMethods
|
10
|
+
def userstamps(include_deleted_by = false)
|
11
|
+
column(MagicUserstamp.compatibility_mode ? :created_by : :creator_id, :integer)
|
12
|
+
column(MagicUserstamp.compatibility_mode ? :updated_by : :updater_id, :integer)
|
13
|
+
column(MagicUserstamp.compatibility_mode ? :deleted_by : :deleter_id, :integer) if include_deleted_by
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require '
|
2
|
+
require 'magic_userstamp'
|
3
3
|
|
4
|
-
module
|
4
|
+
module MagicUserstamp
|
5
5
|
# Determines what default columns to use for recording the current stamper.
|
6
6
|
# By default this is set to false, so the plug-in will use columns named
|
7
7
|
# <tt>creator_id</tt>, <tt>updater_id</tt>, and <tt>deleter_id</tt>.
|
@@ -9,7 +9,7 @@ module Userstamp
|
|
9
9
|
# To turn compatibility mode on, place the following line in your environment.rb
|
10
10
|
# file:
|
11
11
|
#
|
12
|
-
#
|
12
|
+
# MagicUserstamp.compatibility_mode = true
|
13
13
|
#
|
14
14
|
# This will cause the plug-in to use columns named <tt>created_by</tt>,
|
15
15
|
# <tt>updated_by</tt>, and <tt>deleted_by</tt>.
|
@@ -25,12 +25,6 @@ module Userstamp
|
|
25
25
|
:actual_hook
|
26
26
|
]
|
27
27
|
|
28
|
-
def self.raise_unless_valid_options_for_stampable_on(options)
|
29
|
-
return if options.nil?
|
30
|
-
invalid_keys = (options.keys - VALID_OPTIONS_KEYS_FOR_STAMPABLE_ON)
|
31
|
-
raise "Invalid options keys: #{invalid_keys.inspect}" unless invalid_keys.empty?
|
32
|
-
end
|
33
|
-
|
34
28
|
# Extends the stamping functionality of ActiveRecord by automatically recording the model
|
35
29
|
# responsible for creating, updating, and deleting the current object. See the Stamper
|
36
30
|
# and Userstamp modules for further documentation on how the entire process works.
|
@@ -44,6 +38,12 @@ module Userstamp
|
|
44
38
|
end
|
45
39
|
end
|
46
40
|
|
41
|
+
def self.raise_unless_valid_options_for_stampable_on(options)
|
42
|
+
return if options.nil?
|
43
|
+
invalid_keys = (options.keys - VALID_OPTIONS_KEYS_FOR_STAMPABLE_ON)
|
44
|
+
raise "Invalid options keys: #{invalid_keys.inspect}" unless invalid_keys.empty?
|
45
|
+
end
|
46
|
+
|
47
47
|
module ClassMethods
|
48
48
|
# This method is automatically called on for all classes that inherit from
|
49
49
|
# ActiveRecord, but if you need to customize how the plug-in functions, this is the
|
@@ -59,7 +59,7 @@ module Userstamp
|
|
59
59
|
# The method will automatically setup all the associations, and create <tt>before_save</tt>
|
60
60
|
# and <tt>before_create</tt> filters for doing the stamping.
|
61
61
|
def stampable(options = {})
|
62
|
-
reader_name =
|
62
|
+
reader_name = MagicUserstamp.compatibility_mode ? :default_attribute_compatible : :default_attribute
|
63
63
|
options = {
|
64
64
|
:stamper_class_name => "User",
|
65
65
|
:creator_attribute => Event[:create ].send(reader_name),
|
@@ -78,9 +78,9 @@ module Userstamp
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def stampable_on(event_name, options = {})
|
81
|
-
|
81
|
+
MagicUserstamp::Stampable.raise_unless_valid_options_for_stampable_on(options)
|
82
82
|
event = Event[event_name]
|
83
|
-
reader_name =
|
83
|
+
reader_name = MagicUserstamp.compatibility_mode ? :default_attribute_compatible : :default_attribute
|
84
84
|
options = {
|
85
85
|
:stamper_name => event.actor,
|
86
86
|
:stamper_class_name => "User",
|
@@ -102,8 +102,8 @@ module Userstamp
|
|
102
102
|
#{options[:actual_hook] || event.actual_hook} :#{callback_method_name}
|
103
103
|
|
104
104
|
def #{callback_method_name}
|
105
|
-
if
|
106
|
-
logger.debug("aborting #{self.name}.#{callback_method_name} cause of record_userstamp is
|
105
|
+
if MagicUserstamp.config.verbose?(self.class, "#{options[:attribute]}") && !self.record_userstamp
|
106
|
+
logger.debug("aborting #{self.name}.#{callback_method_name} cause of record_userstamp is #{self.record_userstamp.inspect}")
|
107
107
|
end
|
108
108
|
return unless self.record_userstamp
|
109
109
|
if RAILS_ENV == 'development'
|
@@ -118,7 +118,7 @@ module Userstamp
|
|
118
118
|
#{event.after_callback}
|
119
119
|
end
|
120
120
|
EOS
|
121
|
-
if
|
121
|
+
if MagicUserstamp.config.verbose?(self, options[:attribute])
|
122
122
|
ActiveRecord::Base.logger.debug "=" * 100
|
123
123
|
ActiveRecord::Base.logger.debug self.name
|
124
124
|
ActiveRecord::Base.logger.debug method_definitions
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require '
|
1
|
+
require 'magic_userstamp'
|
2
2
|
|
3
|
-
module
|
3
|
+
module MagicUserstamp
|
4
4
|
module Stamper
|
5
5
|
def self.included(base) # :nodoc:
|
6
6
|
base.extend(ClassMethods)
|
@@ -9,13 +9,13 @@ module Userstamp
|
|
9
9
|
module ClassMethods
|
10
10
|
def model_stamper
|
11
11
|
# don't allow multiple calls
|
12
|
-
return if self.is_a?(
|
13
|
-
self.extend(
|
12
|
+
return if self.is_a?(MagicUserstamp::Stamper::InstanceMethods)
|
13
|
+
self.extend(MagicUserstamp::Stamper::InstanceMethods)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
module InstanceMethods
|
18
|
-
# Used to set the stamper for a particular request. See the
|
18
|
+
# Used to set the stamper for a particular request. See the MagicUserstamp module for more
|
19
19
|
# details on how to use this method.
|
20
20
|
def stamper=(object)
|
21
21
|
object_stamper = if object.is_a?(ActiveRecord::Base)
|
data/magic_userstamp.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{magic_userstamp}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["akimatter"]
|
@@ -26,34 +26,41 @@ Gem::Specification.new do |s|
|
|
26
26
|
"Rakefile",
|
27
27
|
"VERSION",
|
28
28
|
"init.rb",
|
29
|
-
"lib/
|
30
|
-
"lib/
|
31
|
-
"lib/
|
32
|
-
"lib/
|
33
|
-
"lib/
|
34
|
-
"lib/
|
35
|
-
"lib/
|
36
|
-
"lib/
|
29
|
+
"lib/magic_userstamp.rb",
|
30
|
+
"lib/magic_userstamp/config.rb",
|
31
|
+
"lib/magic_userstamp/controller.rb",
|
32
|
+
"lib/magic_userstamp/event.rb",
|
33
|
+
"lib/magic_userstamp/magic_columns.rb",
|
34
|
+
"lib/magic_userstamp/migration_helper.rb",
|
35
|
+
"lib/magic_userstamp/stampable.rb",
|
36
|
+
"lib/magic_userstamp/stamper.rb",
|
37
37
|
"magic_userstamp.gemspec",
|
38
|
-
"rdoc/classes/
|
39
|
-
"rdoc/classes/
|
40
|
-
"rdoc/classes/
|
41
|
-
"rdoc/classes/
|
42
|
-
"rdoc/classes/
|
43
|
-
"rdoc/classes/
|
44
|
-
"rdoc/classes/
|
45
|
-
"rdoc/classes/
|
46
|
-
"rdoc/classes/
|
47
|
-
"rdoc/classes/
|
48
|
-
"rdoc/classes/
|
38
|
+
"rdoc/classes/MagicUserstamp.html",
|
39
|
+
"rdoc/classes/MagicUserstamp/Config.html",
|
40
|
+
"rdoc/classes/MagicUserstamp/Config/Pattern.html",
|
41
|
+
"rdoc/classes/MagicUserstamp/Controller.html",
|
42
|
+
"rdoc/classes/MagicUserstamp/Controller/InstanceMethods.html",
|
43
|
+
"rdoc/classes/MagicUserstamp/Event.html",
|
44
|
+
"rdoc/classes/MagicUserstamp/MagicColumns.html",
|
45
|
+
"rdoc/classes/MagicUserstamp/MagicColumns/ClassMethods.html",
|
46
|
+
"rdoc/classes/MagicUserstamp/MagicUserstampError.html",
|
47
|
+
"rdoc/classes/MagicUserstamp/MigrationHelper.html",
|
48
|
+
"rdoc/classes/MagicUserstamp/MigrationHelper/InstanceMethods.html",
|
49
|
+
"rdoc/classes/MagicUserstamp/Stampable.html",
|
50
|
+
"rdoc/classes/MagicUserstamp/Stampable/ClassMethods.html",
|
51
|
+
"rdoc/classes/MagicUserstamp/Stamper.html",
|
52
|
+
"rdoc/classes/MagicUserstamp/Stamper/ClassMethods.html",
|
53
|
+
"rdoc/classes/MagicUserstamp/Stamper/InstanceMethods.html",
|
49
54
|
"rdoc/created.rid",
|
50
|
-
"rdoc/files/
|
51
|
-
"rdoc/files/
|
52
|
-
"rdoc/files/
|
53
|
-
"rdoc/files/lib/
|
54
|
-
"rdoc/files/lib/
|
55
|
-
"rdoc/files/lib/
|
56
|
-
"rdoc/files/lib/
|
55
|
+
"rdoc/files/README_rdoc.html",
|
56
|
+
"rdoc/files/lib/magic_userstamp/config_rb.html",
|
57
|
+
"rdoc/files/lib/magic_userstamp/controller_rb.html",
|
58
|
+
"rdoc/files/lib/magic_userstamp/event_rb.html",
|
59
|
+
"rdoc/files/lib/magic_userstamp/magic_columns_rb.html",
|
60
|
+
"rdoc/files/lib/magic_userstamp/migration_helper_rb.html",
|
61
|
+
"rdoc/files/lib/magic_userstamp/stampable_rb.html",
|
62
|
+
"rdoc/files/lib/magic_userstamp/stamper_rb.html",
|
63
|
+
"rdoc/files/lib/magic_userstamp_rb.html",
|
57
64
|
"rdoc/fr_class_index.html",
|
58
65
|
"rdoc/fr_file_index.html",
|
59
66
|
"rdoc/fr_method_index.html",
|
@@ -69,9 +76,9 @@ Gem::Specification.new do |s|
|
|
69
76
|
"spec/magic_column_spec.rb",
|
70
77
|
"spec/posts_controller_spec.rb",
|
71
78
|
"spec/resources/controllers/application_controller.rb",
|
79
|
+
"spec/resources/controllers/magic_userstamp_controller.rb",
|
72
80
|
"spec/resources/controllers/posts_controller.rb",
|
73
81
|
"spec/resources/controllers/users_controller.rb",
|
74
|
-
"spec/resources/controllers/userstamp_controller.rb",
|
75
82
|
"spec/resources/models/comment.rb",
|
76
83
|
"spec/resources/models/person.rb",
|
77
84
|
"spec/resources/models/ping.rb",
|
@@ -94,9 +101,9 @@ Gem::Specification.new do |s|
|
|
94
101
|
"spec/magic_column_spec.rb",
|
95
102
|
"spec/posts_controller_spec.rb",
|
96
103
|
"spec/resources/controllers/application_controller.rb",
|
104
|
+
"spec/resources/controllers/magic_userstamp_controller.rb",
|
97
105
|
"spec/resources/controllers/posts_controller.rb",
|
98
106
|
"spec/resources/controllers/users_controller.rb",
|
99
|
-
"spec/resources/controllers/userstamp_controller.rb",
|
100
107
|
"spec/resources/models/comment.rb",
|
101
108
|
"spec/resources/models/person.rb",
|
102
109
|
"spec/resources/models/ping.rb",
|