classy-inheritance 0.4.2 → 0.4.3
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/lib/classy-inheritance.rb +1 -1
- data/lib/classy-inheritance/version.rb +1 -1
- data/website/index.html +7 -81
- data/website/index.txt +5 -66
- metadata +1 -1
data/lib/classy-inheritance.rb
CHANGED
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>Classy Inheritance</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/classyinherit"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/classyinherit" class="numbers">0.4.
|
36
|
+
<a href="http://rubyforge.org/projects/classyinherit" class="numbers">0.4.3</a>
|
37
37
|
</div>
|
38
38
|
<p><i>“You stay classy, inheritance” – Gibson</i></p>
|
39
39
|
|
@@ -44,93 +44,19 @@
|
|
44
44
|
<p>Maintaining this page, the wiki at GitHub, the Google Group and no issue tracker is not an ideal setup. So, everything is moving to <a href="http://stonean.com">stonean.com</a> where I’m giving <a href="http://redmine.org">Redmine</a> a shot a running everything for me. I’ll be posting release announcements to the news feed for each project and keeping the docs up-to-date. Hopefully this will be better for everyone.</p>
|
45
45
|
|
46
46
|
|
47
|
-
<
|
48
|
-
-andy</p>
|
49
|
-
|
50
|
-
|
51
|
-
<h2>What</h2>
|
52
|
-
|
53
|
-
|
54
|
-
<p>For now, Classy Inheritance adds a depends_on class method to your ActiveRecord model so that you can define requisite objects.
|
55
|
-
More functionality coming for optional relationships.</p>
|
56
|
-
|
57
|
-
|
58
|
-
You can define the relationship to be polymorphic:
|
59
|
-
<pre>
|
60
|
-
class Picture < ActiveRecord::Base
|
61
|
-
depends_on :image, :attrs => [:filename, :height, :width], :as => "imageable"
|
62
|
-
end
|
63
|
-
</pre>
|
64
|
-
|
65
|
-
<p>This will look for “imageable_type” and “imageable_id” on the images table add set them accordingly.</p>
|
66
|
-
|
67
|
-
|
68
|
-
Or you can define a standard belongs_to relationship:
|
69
|
-
<pre>
|
70
|
-
class User < ActiveRecord::Base
|
71
|
-
depends_on :profile, :attrs => [:first_name, :last_name, :email]
|
72
|
-
end
|
73
|
-
</pre>
|
74
|
-
|
75
|
-
<h3>What does it do for me?</h3>
|
76
|
-
|
77
|
-
|
78
|
-
<p>Well, for starters you get pass-through methods added to your model. So, in the above User example you would get the following:</p>
|
79
|
-
|
80
|
-
|
81
|
-
<pre>
|
82
|
-
@user.first_name
|
83
|
-
@user.last_name
|
84
|
-
@user.email
|
85
|
-
@user.first_name=
|
86
|
-
@user.last_name=
|
87
|
-
@user.email=
|
88
|
-
</pre>
|
89
|
-
|
90
|
-
<p>This means you can use these attributes on your form and in your controller instead of having to worry about creating/updating a separate Profile model.</p>
|
91
|
-
|
92
|
-
|
93
|
-
<p>For the above example, you’ll also get a “find_with_profile” class method that will do the :include => :profile addition to your find call for you.</p>
|
47
|
+
<h2>Quick links</h2>
|
94
48
|
|
95
49
|
|
96
|
-
<
|
50
|
+
<p><a href="http://stonean.com/wiki/classy-inheritance">Wiki</a></p>
|
97
51
|
|
98
52
|
|
99
|
-
<
|
100
|
-
$ sudo gem install classy-inheritance
|
53
|
+
<p><a href="http://stonean.com/projects/classy-inheritance/boards">Forum</a></p>
|
101
54
|
|
102
|
-
# in environment.rb add:
|
103
|
-
require "classy-inheritance"
|
104
55
|
|
105
|
-
|
106
|
-
|
107
|
-
<h2>Github</h2>
|
108
|
-
|
109
|
-
|
110
|
-
<p>The Clone <span class="caps">URL</span>: git://github.com/stonean/classy-inheritance.git</p>
|
111
|
-
|
112
|
-
|
113
|
-
<p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people’s code</a>.</p>
|
114
|
-
|
115
|
-
|
116
|
-
<p>I’m new to git and this whole opensource project admin gig, so please be patient with my stumbling around.</p>
|
117
|
-
|
118
|
-
|
119
|
-
<h2>Contact</h2>
|
120
|
-
|
121
|
-
|
122
|
-
<p>Please use the <a href="http://stonean.com/projects/classy-inheritance/boards">forum</a> to ask questions and the <a href="http://stonean.com/projects/classy-inheritance/issues">issue tracker</a> to report problems or submit a pull request.</p>
|
123
|
-
|
124
|
-
|
125
|
-
<h2>License</h2>
|
126
|
-
|
127
|
-
|
128
|
-
<p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
|
129
|
-
|
130
|
-
|
131
|
-
<p>Copyright© 2008 Andrew Stone</p>
|
56
|
+
<p>Thanks for your interest in Classy Inheritance,<br/>
|
57
|
+
-andy</p>
|
132
58
|
<p class="coda">
|
133
|
-
<a href="http://blog.stonean.com">Andrew Stone</a>,
|
59
|
+
<a href="http://blog.stonean.com">Andrew Stone</a>, 24th June 2008<br>
|
134
60
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
135
61
|
</p>
|
136
62
|
</div>
|
data/website/index.txt
CHANGED
@@ -6,72 +6,11 @@ h2. Consolidation of information
|
|
6
6
|
|
7
7
|
Maintaining this page, the wiki at GitHub, the Google Group and no issue tracker is not an ideal setup. So, everything is moving to "stonean.com":http://stonean.com where I'm giving "Redmine":http://redmine.org a shot a running everything for me. I'll be posting release announcements to the news feed for each project and keeping the docs up-to-date. Hopefully this will be better for everyone.
|
8
8
|
|
9
|
-
|
10
|
-
-andy
|
11
|
-
|
12
|
-
|
13
|
-
h2. What
|
14
|
-
|
15
|
-
For now, Classy Inheritance adds a depends_on class method to your ActiveRecord model so that you can define requisite objects.
|
16
|
-
More functionality coming for optional relationships.
|
17
|
-
|
18
|
-
You can define the relationship to be polymorphic:
|
19
|
-
<pre>
|
20
|
-
class Picture < ActiveRecord::Base
|
21
|
-
depends_on :image, :attrs => [:filename, :height, :width], :as => "imageable"
|
22
|
-
end
|
23
|
-
</pre>
|
24
|
-
|
25
|
-
This will look for "imageable_type" and "imageable_id" on the images table add set them accordingly.
|
26
|
-
|
27
|
-
Or you can define a standard belongs_to relationship:
|
28
|
-
<pre>
|
29
|
-
class User < ActiveRecord::Base
|
30
|
-
depends_on :profile, :attrs => [:first_name, :last_name, :email]
|
31
|
-
end
|
32
|
-
</pre>
|
33
|
-
|
34
|
-
h3. What does it do for me?
|
35
|
-
|
36
|
-
Well, for starters you get pass-through methods added to your model. So, in the above User example you would get the following:
|
37
|
-
|
38
|
-
<pre>
|
39
|
-
@user.first_name
|
40
|
-
@user.last_name
|
41
|
-
@user.email
|
42
|
-
@user.first_name=
|
43
|
-
@user.last_name=
|
44
|
-
@user.email=
|
45
|
-
</pre>
|
46
|
-
|
47
|
-
This means you can use these attributes on your form and in your controller instead of having to worry about creating/updating a separate Profile model.
|
48
|
-
|
49
|
-
For the above example, you'll also get a "find_with_profile" class method that will do the :include => :profile addition to your find call for you.
|
9
|
+
h2. Quick links
|
50
10
|
|
51
|
-
|
11
|
+
"Wiki":http://stonean.com/wiki/classy-inheritance
|
52
12
|
|
53
|
-
|
54
|
-
$ sudo gem install classy-inheritance
|
13
|
+
"Forum":http://stonean.com/projects/classy-inheritance/boards
|
55
14
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
</pre>
|
60
|
-
|
61
|
-
h2. Github
|
62
|
-
|
63
|
-
The Clone URL: git://github.com/stonean/classy-inheritance.git
|
64
|
-
|
65
|
-
Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/.
|
66
|
-
|
67
|
-
I'm new to git and this whole opensource project admin gig, so please be patient with my stumbling around.
|
68
|
-
|
69
|
-
h2. Contact
|
70
|
-
|
71
|
-
Please use the "forum":http://stonean.com/projects/classy-inheritance/boards to ask questions and the "issue tracker":http://stonean.com/projects/classy-inheritance/issues to report problems or submit a pull request.
|
72
|
-
|
73
|
-
h2. License
|
74
|
-
|
75
|
-
This code is free to use under the terms of the MIT license.
|
76
|
-
|
77
|
-
Copyright (c) 2008 Andrew Stone
|
15
|
+
Thanks for your interest in Classy Inheritance,<br/>
|
16
|
+
-andy
|