has_delegates 0.5.3 → 0.5.4
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 +30 -3
- data/Rakefile +1 -1
- metadata +29 -14
data/README
CHANGED
@@ -1,16 +1,43 @@
|
|
1
1
|
has_delegates
|
2
2
|
=============
|
3
3
|
|
4
|
-
Rails plugin providing
|
4
|
+
Rails plugin/gem providing enhanced sub-model delegation to models.
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
This plugin implements all the small details to give you nice submodel
|
7
|
+
delegation.
|
8
|
+
|
9
|
+
Example
|
10
|
+
=======
|
11
|
+
|
12
|
+
There's two new class methods made available to ActiveRecord::Base:
|
13
|
+
|
14
|
+
* belongs_to_delegate(delegate_id, options => {})
|
15
|
+
* has_one_delegate(delegate_id, options = {})
|
16
|
+
|
17
|
+
Use it like this:
|
18
|
+
|
19
|
+
class Vcard < ActiveRecord::Base
|
20
|
+
has_one :address
|
21
|
+
has_one_delegate :address
|
22
|
+
end
|
23
|
+
|
24
|
+
You may now use all the attributes from the Address model in your Vcard
|
25
|
+
records.
|
26
|
+
|
27
|
+
The delegated to record will be created when one of it's attributes is
|
28
|
+
written to. It will be saved when the original record is saved.
|
29
|
+
|
30
|
+
It is possible to use more than one delegation per model.
|
8
31
|
|
9
32
|
License
|
10
33
|
=======
|
11
34
|
|
35
|
+
Based on code described at
|
36
|
+
http://sean-carley.blogspot.com/2006/09/activerecord-delegation-and-demeter.html
|
37
|
+
|
12
38
|
Copyright (c) 2006 Sean Carley <http://sean-carley.blogspot.com>
|
13
39
|
Copyright (c) 2009-2010 Simon Hürlimann <simon.huerlimann@cyt.ch>
|
40
|
+
Copyright (c) 2010 CyT <http://www.cyt.ch>
|
14
41
|
Copyright (c) 2009-2010 ZytoLabor <http://www.zyto-labor.com>
|
15
42
|
|
16
43
|
Released under the MIT license.
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ begin
|
|
7
7
|
GEM = "has_delegates"
|
8
8
|
AUTHOR = "Simon Hürlimann"
|
9
9
|
EMAIL = "simon.huerlimann@cyt.ch"
|
10
|
-
SUMMARY = "Rails plugin providing
|
10
|
+
SUMMARY = "Rails plugin/gem providing enhanced sub-model delegation to models."
|
11
11
|
HOMEPAGE = "http://github.com/huerlisi/has_delegates/tree/master"
|
12
12
|
|
13
13
|
gem 'jeweler', '>= 1.0.0'
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_delegates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 5
|
8
|
+
- 4
|
9
|
+
version: 0.5.4
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- "Simon H\xC3\xBCrlimann"
|
@@ -14,25 +19,33 @@ default_executable:
|
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: activesupport
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 2
|
29
|
+
- 3
|
30
|
+
- 0
|
23
31
|
version: 2.3.0
|
24
|
-
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
25
34
|
- !ruby/object:Gem::Dependency
|
26
35
|
name: actionpack
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
38
|
requirements:
|
31
39
|
- - ">="
|
32
40
|
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 2
|
43
|
+
- 3
|
44
|
+
- 0
|
33
45
|
version: 2.3.0
|
34
|
-
|
35
|
-
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
description: Rails plugin/gem providing enhanced sub-model delegation to models.
|
36
49
|
email: simon.huerlimann@cyt.ch
|
37
50
|
executables: []
|
38
51
|
|
@@ -60,20 +73,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
73
|
requirements:
|
61
74
|
- - ">="
|
62
75
|
- !ruby/object:Gem::Version
|
76
|
+
segments:
|
77
|
+
- 0
|
63
78
|
version: "0"
|
64
|
-
version:
|
65
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
80
|
requirements:
|
67
81
|
- - ">="
|
68
82
|
- !ruby/object:Gem::Version
|
83
|
+
segments:
|
84
|
+
- 0
|
69
85
|
version: "0"
|
70
|
-
version:
|
71
86
|
requirements: []
|
72
87
|
|
73
88
|
rubyforge_project:
|
74
|
-
rubygems_version: 1.3.
|
89
|
+
rubygems_version: 1.3.6
|
75
90
|
signing_key:
|
76
91
|
specification_version: 3
|
77
|
-
summary: Rails plugin providing
|
92
|
+
summary: Rails plugin/gem providing enhanced sub-model delegation to models.
|
78
93
|
test_files:
|
79
94
|
- test/has_delegates_test.rb
|