acts_as_current 0.1.0 → 1.0.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/.specification +115 -0
- data/README.rdoc +65 -24
- data/VERSION +1 -1
- data/acts_as_current.gemspec +5 -4
- data/test/test_helper.rb +0 -1
- metadata +14 -4
data/.specification
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: acts_as_current
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Coroutine
|
14
|
+
- John Dugan
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2010-10-10 00:00:00 -05:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: activerecord
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
version: "0"
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: activesupport
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
type: :development
|
49
|
+
version_requirements: *id002
|
50
|
+
description: This acts_as extension modifies ActiveRecord classes so they can carry a reference to the instance defined as current for the given request. The library is particularly useful for providing the authenticated user object to models.
|
51
|
+
email: gem@coroutine.com
|
52
|
+
executables: []
|
53
|
+
|
54
|
+
extensions: []
|
55
|
+
|
56
|
+
extra_rdoc_files:
|
57
|
+
- README.rdoc
|
58
|
+
files:
|
59
|
+
- .gitignore
|
60
|
+
- .specification
|
61
|
+
- MIT-LICENSE
|
62
|
+
- README.rdoc
|
63
|
+
- Rakefile
|
64
|
+
- VERSION
|
65
|
+
- acts_as_current.gemspec
|
66
|
+
- init.rb
|
67
|
+
- lib/acts_as_current.rb
|
68
|
+
- lib/acts_as_current/base.rb
|
69
|
+
- lib/acts_as_current/class_methods.rb
|
70
|
+
- lib/acts_as_current/instance_methods.rb
|
71
|
+
- rails/init.rb
|
72
|
+
- test/acts_as_current/base_test.rb
|
73
|
+
- test/acts_as_current/simple_test.rb
|
74
|
+
- test/acts_as_current/sti_test.rb
|
75
|
+
- test/test_helper.rb
|
76
|
+
has_rdoc: true
|
77
|
+
homepage: http://github.com/coroutine/acts_as_current
|
78
|
+
licenses: []
|
79
|
+
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options:
|
82
|
+
- --charset=UTF-8
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
103
|
+
requirements: []
|
104
|
+
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 1.3.7
|
107
|
+
signing_key:
|
108
|
+
specification_version: 3
|
109
|
+
summary: Gem version of acts_as_current Rails plugin.
|
110
|
+
test_files:
|
111
|
+
- test/acts_as_current/base_test.rb
|
112
|
+
- test/acts_as_current/simple_test.rb
|
113
|
+
- test/acts_as_current/sti_test.rb
|
114
|
+
- test/test_helper.rb
|
115
|
+
|
data/README.rdoc
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
This library extends ActiveRecord classes so they can carry a reference to the
|
4
4
|
instance defined as current for the given request.
|
5
5
|
|
6
|
+
|
7
|
+
|
8
|
+
== Usage
|
9
|
+
|
6
10
|
<tt>acts_as_current</tt> can be applied to any model, but it's most common use case is
|
7
11
|
storing the authenticated user on the corresponding User model. Doing so allows other models
|
8
12
|
and observers to access information about the user who made the request. This is particularly
|
@@ -44,6 +48,28 @@ into the model class.
|
|
44
48
|
|
45
49
|
|
46
50
|
|
51
|
+
== Simple Controller Recipe
|
52
|
+
|
53
|
+
He's an example of how you might set a current instance on a User class via a
|
54
|
+
current_user method, using a before filter in the application controller.
|
55
|
+
|
56
|
+
before_filter { |controller| User.current = controller.send(:current_user) }
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
== Why Doesn't the Library Handle the Controller Logic For Me?
|
61
|
+
|
62
|
+
Primarily, because we think ActiveRecord extensions have no business altering
|
63
|
+
controller logic. Doing so couples aspects of your application that Rails is going
|
64
|
+
out of its way to separate.
|
65
|
+
|
66
|
+
But also because the before_filter syntax is already configurable and extremely expressive.
|
67
|
+
Writing the before filter is no harder than writing a module include statement, but the former
|
68
|
+
tells a code maintainer <b>considerably</b> more information than the latter.
|
69
|
+
|
70
|
+
In summary, suck it up and write the controller code yourself. :-)
|
71
|
+
|
72
|
+
|
47
73
|
|
48
74
|
== Design Notes
|
49
75
|
|
@@ -57,7 +83,6 @@ We think the real benefits outweigh the perceived risks.
|
|
57
83
|
|
58
84
|
|
59
85
|
|
60
|
-
|
61
86
|
== Helpful Links
|
62
87
|
|
63
88
|
* <b>Repository:</b> http://github.com/coroutine/acts_as_current
|
@@ -66,48 +91,64 @@ We think the real benefits outweigh the perceived risks.
|
|
66
91
|
|
67
92
|
|
68
93
|
|
94
|
+
== Installation (Rails 3)
|
69
95
|
|
70
|
-
|
71
|
-
|
72
|
-
Install me from RubyGems.org and add a gem dependency in your configuration file.
|
73
|
-
|
74
|
-
$ sudo gem install acts_as_current
|
75
|
-
|
76
|
-
Or install me as a plugin.
|
77
|
-
|
78
|
-
$ script/plugin install git://github.com/coroutine/acts_as_current.git
|
96
|
+
Install me from RubyGems.org by adding a gem dependency to your Gemfile. Bundler does
|
97
|
+
the rest.
|
79
98
|
|
99
|
+
gem "acts_as_current"
|
80
100
|
|
101
|
+
$ bundle install
|
81
102
|
|
82
103
|
|
83
|
-
== Simple Controller Recipe
|
84
|
-
|
85
|
-
He's an example of how you might set a current instance on a User class via a
|
86
|
-
current_user method, using a before filter in the application controller.
|
87
104
|
|
88
|
-
|
105
|
+
== Installation (Rails 2)
|
89
106
|
|
107
|
+
Install me from RubyGems.org and add a gem dependency in your configuration file.
|
90
108
|
|
109
|
+
$ sudo gem install acts_as_current
|
91
110
|
|
111
|
+
Or install me as a plugin.
|
92
112
|
|
93
|
-
|
113
|
+
$ script/plugin install git://github.com/coroutine/acts_as_current.git
|
114
|
+
|
94
115
|
|
95
|
-
Primarily, because we think ActiveRecord extensions have no business altering
|
96
|
-
controller logic. Doing so couples aspects of your application that Rails is going
|
97
|
-
out of its way to separate.
|
98
116
|
|
99
|
-
|
100
|
-
Writing the before filter is no harder than writing a module include statement, but the former
|
101
|
-
tells a code maintainer <b>considerably</b> more information than the latter.
|
117
|
+
== Gemroll
|
102
118
|
|
103
|
-
|
119
|
+
Other gems by Coroutine include:
|
104
120
|
|
121
|
+
* {acts_as_label}[http://github.com/coroutine/acts_as_label]
|
122
|
+
* {acts_as_list_with_sti_support}[http://github.com/coroutine/acts_as_list_with_sti_support]
|
123
|
+
* {delayed_form_observer}[http://github.com/coroutine/delayed_form_observer]
|
124
|
+
* {kenny_dialoggins}[http://github.com/coroutine/kenny_dialoggins]
|
125
|
+
* {michael_hintbuble}[http://github.com/coroutine/michael_hintbuble]
|
126
|
+
* {tiny_navigation}[http://github.com/coroutine/tiny_navigation]
|
105
127
|
|
106
128
|
|
107
129
|
|
108
130
|
== License
|
109
131
|
|
110
|
-
Copyright (c) 2010 {Coroutine LLC}[http://coroutine.com]
|
132
|
+
Copyright (c) 2010 {Coroutine LLC}[http://coroutine.com].
|
133
|
+
|
134
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
135
|
+
a copy of this software and associated documentation files (the
|
136
|
+
"Software"), to deal in the Software without restriction, including
|
137
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
138
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
139
|
+
permit persons to whom the Software is furnished to do so, subject to
|
140
|
+
the following conditions:
|
141
|
+
|
142
|
+
The above copyright notice and this permission notice shall be
|
143
|
+
included in all copies or substantial portions of the Software.
|
144
|
+
|
145
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
146
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
147
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
148
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
149
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
150
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
151
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
111
152
|
|
112
153
|
acts_as_current was inspired by sentient_user, copyright (c) 2009 bokmann, also released under the
|
113
154
|
MIT license.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
1.0.0
|
data/acts_as_current.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{acts_as_current}
|
8
|
-
s.version = "
|
8
|
+
s.version = "1.0.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Coroutine", "John Dugan"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-10-10}
|
13
13
|
s.description = %q{This acts_as extension modifies ActiveRecord classes so they can carry a reference to the instance defined as current for the given request. The library is particularly useful for providing the authenticated user object to models.}
|
14
14
|
s.email = %q{gem@coroutine.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
]
|
18
18
|
s.files = [
|
19
19
|
".gitignore",
|
20
|
+
".specification",
|
20
21
|
"MIT-LICENSE",
|
21
22
|
"README.rdoc",
|
22
23
|
"Rakefile",
|
@@ -36,7 +37,7 @@ Gem::Specification.new do |s|
|
|
36
37
|
s.homepage = %q{http://github.com/coroutine/acts_as_current}
|
37
38
|
s.rdoc_options = ["--charset=UTF-8"]
|
38
39
|
s.require_paths = ["lib"]
|
39
|
-
s.rubygems_version = %q{1.3.
|
40
|
+
s.rubygems_version = %q{1.3.7}
|
40
41
|
s.summary = %q{Gem version of acts_as_current Rails plugin.}
|
41
42
|
s.test_files = [
|
42
43
|
"test/acts_as_current/base_test.rb",
|
@@ -49,7 +50,7 @@ Gem::Specification.new do |s|
|
|
49
50
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
51
|
s.specification_version = 3
|
51
52
|
|
52
|
-
if Gem::Version.new(Gem::
|
53
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
54
|
s.add_runtime_dependency(%q<activerecord>, [">= 0"])
|
54
55
|
s.add_development_dependency(%q<activesupport>, [">= 0"])
|
55
56
|
else
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_current
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
|
-
- 0
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Coroutine
|
@@ -15,16 +16,18 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-
|
19
|
+
date: 2010-10-10 00:00:00 -05:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: activerecord
|
23
24
|
prerelease: false
|
24
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
25
27
|
requirements:
|
26
28
|
- - ">="
|
27
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
28
31
|
segments:
|
29
32
|
- 0
|
30
33
|
version: "0"
|
@@ -34,9 +37,11 @@ dependencies:
|
|
34
37
|
name: activesupport
|
35
38
|
prerelease: false
|
36
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
37
41
|
requirements:
|
38
42
|
- - ">="
|
39
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
40
45
|
segments:
|
41
46
|
- 0
|
42
47
|
version: "0"
|
@@ -52,6 +57,7 @@ extra_rdoc_files:
|
|
52
57
|
- README.rdoc
|
53
58
|
files:
|
54
59
|
- .gitignore
|
60
|
+
- .specification
|
55
61
|
- MIT-LICENSE
|
56
62
|
- README.rdoc
|
57
63
|
- Rakefile
|
@@ -77,23 +83,27 @@ rdoc_options:
|
|
77
83
|
require_paths:
|
78
84
|
- lib
|
79
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
80
87
|
requirements:
|
81
88
|
- - ">="
|
82
89
|
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
83
91
|
segments:
|
84
92
|
- 0
|
85
93
|
version: "0"
|
86
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
87
96
|
requirements:
|
88
97
|
- - ">="
|
89
98
|
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
90
100
|
segments:
|
91
101
|
- 0
|
92
102
|
version: "0"
|
93
103
|
requirements: []
|
94
104
|
|
95
105
|
rubyforge_project:
|
96
|
-
rubygems_version: 1.3.
|
106
|
+
rubygems_version: 1.3.7
|
97
107
|
signing_key:
|
98
108
|
specification_version: 3
|
99
109
|
summary: Gem version of acts_as_current Rails plugin.
|