magic_userstamp 0.1.0
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/.gitignore +5 -0
- data/CHANGELOG +26 -0
- data/LICENSE +20 -0
- data/README.original +179 -0
- data/README.rdoc +64 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/init.rb +12 -0
- data/lib/userstamp/config.rb +119 -0
- data/lib/userstamp/controller.rb +43 -0
- data/lib/userstamp/event.rb +63 -0
- data/lib/userstamp/magic_columns.rb +49 -0
- data/lib/userstamp/migration_helper.rb +17 -0
- data/lib/userstamp/stampable.rb +147 -0
- data/lib/userstamp/stamper.rb +41 -0
- data/lib/userstamp.rb +17 -0
- data/magic_userstamp.gemspec +124 -0
- data/rdoc/classes/Ddb/Controller/Userstamp/InstanceMethods.html +105 -0
- data/rdoc/classes/Ddb/Controller/Userstamp.html +125 -0
- data/rdoc/classes/Ddb/Controller.html +111 -0
- data/rdoc/classes/Ddb/Userstamp/MigrationHelper/InstanceMethods.html +142 -0
- data/rdoc/classes/Ddb/Userstamp/MigrationHelper.html +111 -0
- data/rdoc/classes/Ddb/Userstamp/Stampable/ClassMethods.html +222 -0
- data/rdoc/classes/Ddb/Userstamp/Stampable.html +128 -0
- data/rdoc/classes/Ddb/Userstamp/Stamper/ClassMethods.html +142 -0
- data/rdoc/classes/Ddb/Userstamp/Stamper/InstanceMethods.html +207 -0
- data/rdoc/classes/Ddb/Userstamp/Stamper.html +112 -0
- data/rdoc/classes/Ddb/Userstamp.html +121 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/CHANGELOG.html +137 -0
- data/rdoc/files/LICENSE.html +129 -0
- data/rdoc/files/README.html +341 -0
- data/rdoc/files/lib/migration_helper_rb.html +101 -0
- data/rdoc/files/lib/stampable_rb.html +101 -0
- data/rdoc/files/lib/stamper_rb.html +101 -0
- data/rdoc/files/lib/userstamp_rb.html +101 -0
- data/rdoc/fr_class_index.html +37 -0
- data/rdoc/fr_file_index.html +33 -0
- data/rdoc/fr_method_index.html +33 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- data/spec/compatibility_stamping_spec.rb +76 -0
- data/spec/config_spec.rb +155 -0
- data/spec/database.yml +4 -0
- data/spec/fixtures/comments.yml +16 -0
- data/spec/fixtures/people.yml +11 -0
- data/spec/fixtures/posts.yml +9 -0
- data/spec/fixtures/users.yml +7 -0
- data/spec/magic_column_spec.rb +171 -0
- data/spec/posts_controller_spec.rb +41 -0
- data/spec/resources/controllers/application_controller.rb +2 -0
- data/spec/resources/controllers/posts_controller.rb +26 -0
- data/spec/resources/controllers/users_controller.rb +12 -0
- data/spec/resources/controllers/userstamp_controller.rb +9 -0
- data/spec/resources/models/comment.rb +4 -0
- data/spec/resources/models/person.rb +4 -0
- data/spec/resources/models/ping.rb +7 -0
- data/spec/resources/models/post.rb +4 -0
- data/spec/resources/models/user.rb +4 -0
- data/spec/schema.rb +56 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helper.rb +66 -0
- data/spec/stamping_spec.rb +114 -0
- data/spec/users_controller_spec.rb +33 -0
- metadata +145 -0
@@ -0,0 +1,147 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'userstamp'
|
3
|
+
|
4
|
+
module Userstamp
|
5
|
+
# Determines what default columns to use for recording the current stamper.
|
6
|
+
# By default this is set to false, so the plug-in will use columns named
|
7
|
+
# <tt>creator_id</tt>, <tt>updater_id</tt>, and <tt>deleter_id</tt>.
|
8
|
+
#
|
9
|
+
# To turn compatibility mode on, place the following line in your environment.rb
|
10
|
+
# file:
|
11
|
+
#
|
12
|
+
# Userstamp.compatibility_mode = true
|
13
|
+
#
|
14
|
+
# This will cause the plug-in to use columns named <tt>created_by</tt>,
|
15
|
+
# <tt>updated_by</tt>, and <tt>deleted_by</tt>.
|
16
|
+
mattr_accessor :compatibility_mode
|
17
|
+
@@compatibility_mode = false
|
18
|
+
|
19
|
+
VALID_OPTIONS_KEYS_FOR_STAMPABLE_ON = [
|
20
|
+
:attribute, # :column_name
|
21
|
+
:stamper_name,
|
22
|
+
:stamper_class_name,
|
23
|
+
:stamper_attr_name,
|
24
|
+
:attribute,
|
25
|
+
:actual_hook
|
26
|
+
]
|
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
|
+
# Extends the stamping functionality of ActiveRecord by automatically recording the model
|
35
|
+
# responsible for creating, updating, and deleting the current object. See the Stamper
|
36
|
+
# and Userstamp modules for further documentation on how the entire process works.
|
37
|
+
module Stampable
|
38
|
+
def self.included(base) #:nodoc:
|
39
|
+
base.extend(ClassMethods)
|
40
|
+
base.class_eval do
|
41
|
+
# Should ActiveRecord record userstamps? Defaults to true.
|
42
|
+
class_inheritable_accessor :record_userstamp
|
43
|
+
self.record_userstamp = true
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
module ClassMethods
|
48
|
+
# This method is automatically called on for all classes that inherit from
|
49
|
+
# ActiveRecord, but if you need to customize how the plug-in functions, this is the
|
50
|
+
# method to use. Here's an example:
|
51
|
+
#
|
52
|
+
# class Post < ActiveRecord::Base
|
53
|
+
# stampable :stamper_class_name => :person,
|
54
|
+
# :creator_attribute => :create_user,
|
55
|
+
# :updater_attribute => :update_user,
|
56
|
+
# :deleter_attribute => :delete_user
|
57
|
+
# end
|
58
|
+
#
|
59
|
+
# The method will automatically setup all the associations, and create <tt>before_save</tt>
|
60
|
+
# and <tt>before_create</tt> filters for doing the stamping.
|
61
|
+
def stampable(options = {})
|
62
|
+
reader_name = Userstamp.compatibility_mode ? :default_attribute_compatible : :default_attribute
|
63
|
+
options = {
|
64
|
+
:stamper_class_name => "User",
|
65
|
+
:creator_attribute => Event[:create ].send(reader_name),
|
66
|
+
:updater_attribute => Event[:update ].send(reader_name),
|
67
|
+
:deleter_attribute => Event[:destroy].send(reader_name)
|
68
|
+
}.update(options || {})
|
69
|
+
|
70
|
+
stamper_class_name = options[:stamper_class_name].to_s
|
71
|
+
stamper_class_name = stamper_class_name.camelize unless stamper_class_name =~ /^[A-Z]/
|
72
|
+
|
73
|
+
with_options(:stamper_class_name => stamper_class_name) do |s|
|
74
|
+
s.stampable_on(:create , :attribute => options[:creator_attribute])
|
75
|
+
s.stampable_on(:update , :attribute => options[:updater_attribute])
|
76
|
+
s.stampable_on(:destroy, :attribute => options[:deleter_attribute]) if defined?(Caboose::Acts::Paranoid)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def stampable_on(event_name, options = {})
|
81
|
+
Userstamp.raise_unless_valid_options_for_stampable_on(options)
|
82
|
+
event = Event[event_name]
|
83
|
+
reader_name = Userstamp.compatibility_mode ? :default_attribute_compatible : :default_attribute
|
84
|
+
options = {
|
85
|
+
:stamper_name => event.actor,
|
86
|
+
:stamper_class_name => "User",
|
87
|
+
# :stamper_attribute => nil
|
88
|
+
:attribute => event.send(reader_name),
|
89
|
+
:actual_hook => nil
|
90
|
+
}.update(options || {})
|
91
|
+
|
92
|
+
belongs_to_class_name = options[:stamper_class_name].to_s
|
93
|
+
belongs_to_class_name = belongs_to_class_name.singularize.camelize unless belongs_to_class_name =~ /^[A-Z]/
|
94
|
+
callback_method_name = "set_#{options[:attribute]}_on_#{event.name}"
|
95
|
+
|
96
|
+
line_no = __LINE__ + 2
|
97
|
+
method_definitions = <<-"EOS"
|
98
|
+
belongs_to(:#{options[:stamper_name]},
|
99
|
+
:class_name => '#{belongs_to_class_name}',
|
100
|
+
:foreign_key => '#{options[:attribute].to_s}')
|
101
|
+
|
102
|
+
#{options[:actual_hook] || event.actual_hook} :#{callback_method_name}
|
103
|
+
|
104
|
+
def #{callback_method_name}
|
105
|
+
if Userstamp.config.verbose?(self.class, "#{options[:attribute]}") && !self.record_userstamp
|
106
|
+
logger.debug("aborting #{self.name}.#{callback_method_name} cause of record_userstamp is nil/false")
|
107
|
+
end
|
108
|
+
return unless self.record_userstamp
|
109
|
+
if RAILS_ENV == 'development'
|
110
|
+
@@#{options[:attribute]}_stamper_class = "#{options[:stamper_class_name]}".constantize
|
111
|
+
else
|
112
|
+
@@#{options[:attribute]}_stamper_class ||= "#{options[:stamper_class_name]}".constantize
|
113
|
+
end
|
114
|
+
stamper_class = @@#{options[:attribute]}_stamper_class
|
115
|
+
stamper_class.model_stamper if stamper_class
|
116
|
+
stamper = stamper_class.stamper if stamper_class
|
117
|
+
send("#{options[:attribute]}=", stamper) if stamper
|
118
|
+
#{event.after_callback}
|
119
|
+
end
|
120
|
+
EOS
|
121
|
+
if Userstamp.config.verbose?(self, options[:attribute])
|
122
|
+
ActiveRecord::Base.logger.debug "=" * 100
|
123
|
+
ActiveRecord::Base.logger.debug self.name
|
124
|
+
ActiveRecord::Base.logger.debug method_definitions
|
125
|
+
end
|
126
|
+
module_eval(method_definitions, __FILE__, line_no)
|
127
|
+
end
|
128
|
+
|
129
|
+
# Temporarily allows you to turn stamping off. For example:
|
130
|
+
#
|
131
|
+
# Post.without_stamps do
|
132
|
+
# post = Post.find(params[:id])
|
133
|
+
# post.update_attributes(params[:post])
|
134
|
+
# post.save
|
135
|
+
# end
|
136
|
+
def without_stamps
|
137
|
+
original_value = self.record_userstamp
|
138
|
+
self.record_userstamp = false
|
139
|
+
begin
|
140
|
+
yield
|
141
|
+
ensure
|
142
|
+
self.record_userstamp = original_value
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'userstamp'
|
2
|
+
|
3
|
+
module Userstamp
|
4
|
+
module Stamper
|
5
|
+
def self.included(base) # :nodoc:
|
6
|
+
base.extend(ClassMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
def model_stamper
|
11
|
+
# don't allow multiple calls
|
12
|
+
return if self.is_a?(Userstamp::Stamper::InstanceMethods)
|
13
|
+
self.extend(Userstamp::Stamper::InstanceMethods)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module InstanceMethods
|
18
|
+
# Used to set the stamper for a particular request. See the Userstamp module for more
|
19
|
+
# details on how to use this method.
|
20
|
+
def stamper=(object)
|
21
|
+
object_stamper = if object.is_a?(ActiveRecord::Base)
|
22
|
+
object.send("#{object.class.primary_key}".to_sym)
|
23
|
+
else
|
24
|
+
object
|
25
|
+
end
|
26
|
+
|
27
|
+
Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"] = object_stamper
|
28
|
+
end
|
29
|
+
|
30
|
+
# Retrieves the existing stamper for the current request.
|
31
|
+
def stamper
|
32
|
+
Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"]
|
33
|
+
end
|
34
|
+
|
35
|
+
# Sets the stamper back to +nil+ to prepare for the next request.
|
36
|
+
def reset_stamper
|
37
|
+
Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"] = nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/userstamp.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
module Userstamp
|
3
|
+
autoload :Config, 'userstamp/config'
|
4
|
+
autoload :Controller, 'userstamp/controller'
|
5
|
+
autoload :Event, 'userstamp/event'
|
6
|
+
autoload :MagicColumns, 'userstamp/magic_columns'
|
7
|
+
autoload :MigrationHelper, 'userstamp/migration_helper'
|
8
|
+
autoload :Stampable, 'userstamp/stampable'
|
9
|
+
autoload :Stamper, 'userstamp/stamper'
|
10
|
+
|
11
|
+
class UserstampError < StandardError
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.config
|
15
|
+
Config.instance
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{magic_userstamp}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["akimatter"]
|
12
|
+
s.date = %q{2009-10-28}
|
13
|
+
s.description = %q{This Rails plugin extends ActiveRecord::Base to add automatic updating of created_by and updated_by attributes of your models in much the same way that the ActiveRecord::Timestamp module updates created_(at/on) and updated_(at/on) attributes.}
|
14
|
+
s.email = %q{akm2000@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.original",
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".gitignore",
|
22
|
+
"CHANGELOG",
|
23
|
+
"LICENSE",
|
24
|
+
"README.original",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"init.rb",
|
29
|
+
"lib/userstamp.rb",
|
30
|
+
"lib/userstamp/config.rb",
|
31
|
+
"lib/userstamp/controller.rb",
|
32
|
+
"lib/userstamp/event.rb",
|
33
|
+
"lib/userstamp/magic_columns.rb",
|
34
|
+
"lib/userstamp/migration_helper.rb",
|
35
|
+
"lib/userstamp/stampable.rb",
|
36
|
+
"lib/userstamp/stamper.rb",
|
37
|
+
"magic_userstamp.gemspec",
|
38
|
+
"rdoc/classes/Ddb/Controller.html",
|
39
|
+
"rdoc/classes/Ddb/Controller/Userstamp.html",
|
40
|
+
"rdoc/classes/Ddb/Controller/Userstamp/InstanceMethods.html",
|
41
|
+
"rdoc/classes/Ddb/Userstamp.html",
|
42
|
+
"rdoc/classes/Ddb/Userstamp/MigrationHelper.html",
|
43
|
+
"rdoc/classes/Ddb/Userstamp/MigrationHelper/InstanceMethods.html",
|
44
|
+
"rdoc/classes/Ddb/Userstamp/Stampable.html",
|
45
|
+
"rdoc/classes/Ddb/Userstamp/Stampable/ClassMethods.html",
|
46
|
+
"rdoc/classes/Ddb/Userstamp/Stamper.html",
|
47
|
+
"rdoc/classes/Ddb/Userstamp/Stamper/ClassMethods.html",
|
48
|
+
"rdoc/classes/Ddb/Userstamp/Stamper/InstanceMethods.html",
|
49
|
+
"rdoc/created.rid",
|
50
|
+
"rdoc/files/CHANGELOG.html",
|
51
|
+
"rdoc/files/LICENSE.html",
|
52
|
+
"rdoc/files/README.html",
|
53
|
+
"rdoc/files/lib/migration_helper_rb.html",
|
54
|
+
"rdoc/files/lib/stampable_rb.html",
|
55
|
+
"rdoc/files/lib/stamper_rb.html",
|
56
|
+
"rdoc/files/lib/userstamp_rb.html",
|
57
|
+
"rdoc/fr_class_index.html",
|
58
|
+
"rdoc/fr_file_index.html",
|
59
|
+
"rdoc/fr_method_index.html",
|
60
|
+
"rdoc/index.html",
|
61
|
+
"rdoc/rdoc-style.css",
|
62
|
+
"spec/compatibility_stamping_spec.rb",
|
63
|
+
"spec/config_spec.rb",
|
64
|
+
"spec/database.yml",
|
65
|
+
"spec/fixtures/comments.yml",
|
66
|
+
"spec/fixtures/people.yml",
|
67
|
+
"spec/fixtures/posts.yml",
|
68
|
+
"spec/fixtures/users.yml",
|
69
|
+
"spec/magic_column_spec.rb",
|
70
|
+
"spec/posts_controller_spec.rb",
|
71
|
+
"spec/resources/controllers/application_controller.rb",
|
72
|
+
"spec/resources/controllers/posts_controller.rb",
|
73
|
+
"spec/resources/controllers/users_controller.rb",
|
74
|
+
"spec/resources/controllers/userstamp_controller.rb",
|
75
|
+
"spec/resources/models/comment.rb",
|
76
|
+
"spec/resources/models/person.rb",
|
77
|
+
"spec/resources/models/ping.rb",
|
78
|
+
"spec/resources/models/post.rb",
|
79
|
+
"spec/resources/models/user.rb",
|
80
|
+
"spec/schema.rb",
|
81
|
+
"spec/spec.opts",
|
82
|
+
"spec/spec_helper.rb",
|
83
|
+
"spec/stamping_spec.rb",
|
84
|
+
"spec/users_controller_spec.rb"
|
85
|
+
]
|
86
|
+
s.homepage = %q{http://github.com/akm/magic_userstamp}
|
87
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
88
|
+
s.require_paths = ["lib"]
|
89
|
+
s.rubygems_version = %q{1.3.5}
|
90
|
+
s.summary = %q{creator_id/updater_id/deleter_id support with setting outside models}
|
91
|
+
s.test_files = [
|
92
|
+
"spec/compatibility_stamping_spec.rb",
|
93
|
+
"spec/config_spec.rb",
|
94
|
+
"spec/magic_column_spec.rb",
|
95
|
+
"spec/posts_controller_spec.rb",
|
96
|
+
"spec/resources/controllers/application_controller.rb",
|
97
|
+
"spec/resources/controllers/posts_controller.rb",
|
98
|
+
"spec/resources/controllers/users_controller.rb",
|
99
|
+
"spec/resources/controllers/userstamp_controller.rb",
|
100
|
+
"spec/resources/models/comment.rb",
|
101
|
+
"spec/resources/models/person.rb",
|
102
|
+
"spec/resources/models/ping.rb",
|
103
|
+
"spec/resources/models/post.rb",
|
104
|
+
"spec/resources/models/user.rb",
|
105
|
+
"spec/schema.rb",
|
106
|
+
"spec/spec_helper.rb",
|
107
|
+
"spec/stamping_spec.rb",
|
108
|
+
"spec/users_controller_spec.rb"
|
109
|
+
]
|
110
|
+
|
111
|
+
if s.respond_to? :specification_version then
|
112
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
113
|
+
s.specification_version = 3
|
114
|
+
|
115
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
116
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
117
|
+
else
|
118
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
119
|
+
end
|
120
|
+
else
|
121
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
@@ -0,0 +1,105 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Ddb::Controller::Userstamp::InstanceMethods</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Ddb::Controller::Userstamp::InstanceMethods</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../../files/lib/userstamp_rb.html">
|
59
|
+
lib/userstamp.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
|
80
|
+
</div>
|
81
|
+
|
82
|
+
|
83
|
+
<!-- if includes -->
|
84
|
+
|
85
|
+
<div id="section">
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
<!-- if method_list -->
|
95
|
+
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
<div id="validator-badges">
|
101
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
102
|
+
</div>
|
103
|
+
|
104
|
+
</body>
|
105
|
+
</html>
|
@@ -0,0 +1,125 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Ddb::Controller::Userstamp</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Ddb::Controller::Userstamp</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/userstamp_rb.html">
|
59
|
+
lib/userstamp.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
<div id="description">
|
76
|
+
<p>
|
77
|
+
The <a href="Userstamp.html">Userstamp</a> module, when included into a
|
78
|
+
controller, adds a before filter (named <tt>set_stamper</tt>) and an after
|
79
|
+
filter (name <tt>reset_stamper</tt>). These methods assume a couple of
|
80
|
+
things, but can be re-implemented in your controller to better suite your
|
81
|
+
application.
|
82
|
+
</p>
|
83
|
+
<p>
|
84
|
+
See the documentation for <tt>set_stamper</tt> and <tt>reset_stamper</tt>
|
85
|
+
for specific implementation details.
|
86
|
+
</p>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
|
97
|
+
<!-- if includes -->
|
98
|
+
|
99
|
+
<div id="section">
|
100
|
+
|
101
|
+
<div id="class-list">
|
102
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
103
|
+
|
104
|
+
Module <a href="Userstamp/InstanceMethods.html" class="link">Ddb::Controller::Userstamp::InstanceMethods</a><br />
|
105
|
+
|
106
|
+
</div>
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
<!-- if method_list -->
|
115
|
+
|
116
|
+
|
117
|
+
</div>
|
118
|
+
|
119
|
+
|
120
|
+
<div id="validator-badges">
|
121
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
122
|
+
</div>
|
123
|
+
|
124
|
+
</body>
|
125
|
+
</html>
|
@@ -0,0 +1,111 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Ddb::Controller</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Ddb::Controller</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/userstamp_rb.html">
|
59
|
+
lib/userstamp.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
|
80
|
+
</div>
|
81
|
+
|
82
|
+
|
83
|
+
<!-- if includes -->
|
84
|
+
|
85
|
+
<div id="section">
|
86
|
+
|
87
|
+
<div id="class-list">
|
88
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
89
|
+
|
90
|
+
Module <a href="Controller/Userstamp.html" class="link">Ddb::Controller::Userstamp</a><br />
|
91
|
+
|
92
|
+
</div>
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<!-- if method_list -->
|
101
|
+
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
|
106
|
+
<div id="validator-badges">
|
107
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
108
|
+
</div>
|
109
|
+
|
110
|
+
</body>
|
111
|
+
</html>
|