dr_nic_magic_models 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +9 -9
- data/lib/base.rb +10 -95
- data/lib/connection_adapters/abstract/schema_statements.rb +0 -0
- data/lib/connection_adapters/abstract_adapter.rb +32 -0
- data/lib/connection_adapters/mysql_adapter.rb +42 -0
- data/lib/connection_adapters/postgresql_adapter.rb +45 -0
- data/lib/dr_nic_magic_models/schema.rb +210 -8
- data/lib/dr_nic_magic_models/validations.rb +35 -18
- data/lib/dr_nic_magic_models/version.rb +2 -2
- data/lib/dr_nic_magic_models.rb +13 -2
- data/lib/module.rb +0 -18
- data/lib/rails.rb +19 -0
- data/lib/schema_dumper.rb +0 -0
- data/scripts/txt2js +57 -0
- data/test/connections/native_postgresql/connection.rb +14 -0
- data/test/fixtures/adjectives.yml +3 -0
- data/test/fixtures/adjectives_fun_users.yml +3 -0
- data/test/fixtures/db_definitions/mysql.drop.sql +4 -30
- data/test/fixtures/db_definitions/mysql.sql +30 -2
- data/test/fixtures/db_definitions/postgresql.drop.sql +4 -0
- data/test/fixtures/db_definitions/postgresql.sql +56 -0
- data/test/fixtures/fun_users.yml +8 -1
- data/test/fixtures/group_tag.yml +3 -1
- data/test/fixtures/groups.yml +9 -1
- data/test/foreign_keys_test.rb +0 -0
- data/test/fun_user_plus.rb +2 -0
- data/test/invisible_model_access_test.rb +35 -7
- data/test/invisible_model_assoc_test.rb +34 -19
- data/test/invisible_model_classes_test.rb +5 -1
- data/website/index.html +24 -4
- data/website/index.txt +9 -1
- data/website/template.js +3 -0
- data/website/template.rhtml +10 -1
- data/website/version-raw.js +3 -0
- data/website/version-raw.txt +1 -0
- data/website/version.js +4 -0
- data/website/version.txt +3 -0
- metadata +32 -19
- data/lib/dr_nic_magic_models/associations.rb +0 -12
data/scripts/txt2js
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'redcloth'
|
4
|
+
require 'syntax/convertors/html'
|
5
|
+
require 'erb'
|
6
|
+
require 'active_support'
|
7
|
+
require '../lib/dr_nic_magic_models/version.rb'
|
8
|
+
|
9
|
+
version = DrNicMagicModels::VERSION::STRING
|
10
|
+
download = 'http://rubyforge.org/projects/magicmodels'
|
11
|
+
|
12
|
+
class Fixnum
|
13
|
+
def ordinal
|
14
|
+
# teens
|
15
|
+
return 'th' if (10..19).include?(self % 100)
|
16
|
+
# others
|
17
|
+
case self % 10
|
18
|
+
when 1: return 'st'
|
19
|
+
when 2: return 'nd'
|
20
|
+
when 3: return 'rd'
|
21
|
+
else return 'th'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Time
|
27
|
+
def pretty
|
28
|
+
return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def convert_syntax(syntax, source)
|
33
|
+
return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
|
34
|
+
end
|
35
|
+
|
36
|
+
if ARGV.length >= 1
|
37
|
+
src, template = ARGV
|
38
|
+
template ||= 'template.js'
|
39
|
+
else
|
40
|
+
puts("Usage: #{File.split($0).last} source.txt [template.rhtml] > output.html")
|
41
|
+
exit!
|
42
|
+
end
|
43
|
+
|
44
|
+
template = ERB.new(File.open(template).read)
|
45
|
+
|
46
|
+
title = nil
|
47
|
+
body = nil
|
48
|
+
File.open(src) do |fsrc|
|
49
|
+
title_text = fsrc.readline
|
50
|
+
body = fsrc.read
|
51
|
+
title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
|
52
|
+
end
|
53
|
+
stat = File.stat(src)
|
54
|
+
created = stat.ctime
|
55
|
+
modified = stat.mtime
|
56
|
+
|
57
|
+
$stdout << template.result(binding)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
print "Using Postgres\n"
|
2
|
+
require 'logger'
|
3
|
+
|
4
|
+
ActiveRecord::Base.logger = Logger.new("debug.log")
|
5
|
+
|
6
|
+
db1 = "dr_nic_magic_models_unittest"
|
7
|
+
|
8
|
+
ActiveRecord::Base.establish_connection(
|
9
|
+
:adapter => "postgresql",
|
10
|
+
:username => "postgres",
|
11
|
+
:password => "postgres",
|
12
|
+
:encoding => "utf8",
|
13
|
+
:database => db1
|
14
|
+
)
|
@@ -1,30 +1,4 @@
|
|
1
|
-
DROP TABLE
|
2
|
-
DROP TABLE
|
3
|
-
DROP TABLE
|
4
|
-
DROP TABLE
|
5
|
-
DROP TABLE developers;
|
6
|
-
DROP TABLE projects;
|
7
|
-
DROP TABLE developers_projects;
|
8
|
-
DROP TABLE customers;
|
9
|
-
DROP TABLE orders;
|
10
|
-
DROP TABLE movies;
|
11
|
-
DROP TABLE subscribers;
|
12
|
-
DROP TABLE booleantests;
|
13
|
-
DROP TABLE auto_id_tests;
|
14
|
-
DROP TABLE entrants;
|
15
|
-
DROP TABLE colnametests;
|
16
|
-
DROP TABLE mixins;
|
17
|
-
DROP TABLE people;
|
18
|
-
DROP TABLE readers;
|
19
|
-
DROP TABLE binaries;
|
20
|
-
DROP TABLE computers;
|
21
|
-
DROP TABLE tasks;
|
22
|
-
DROP TABLE posts;
|
23
|
-
DROP TABLE comments;
|
24
|
-
DROP TABLE authors;
|
25
|
-
DROP TABLE categories;
|
26
|
-
DROP TABLE categories_posts;
|
27
|
-
DROP TABLE fk_test_has_fk;
|
28
|
-
DROP TABLE fk_test_has_pk;
|
29
|
-
DROP TABLE keyboards;
|
30
|
-
DROP TABLE legacy_things;
|
1
|
+
DROP TABLE fun_users;
|
2
|
+
DROP TABLE groups;
|
3
|
+
DROP TABLE group_memberships;
|
4
|
+
DROP TABLE group_tag;
|
@@ -1,16 +1,20 @@
|
|
1
1
|
CREATE TABLE `fun_users` (
|
2
2
|
`id` int(11) NOT NULL auto_increment,
|
3
|
+
`type` varchar(255) NOT NULL,
|
3
4
|
`firstname` varchar(50) NOT NULL,
|
4
5
|
`lastname` varchar(50) NOT NULL,
|
5
6
|
`login` varchar(50) NOT NULL,
|
6
|
-
`email` varchar(50) NULL,
|
7
|
+
`email` varchar(50) NULL,
|
7
8
|
PRIMARY KEY (`id`)
|
8
9
|
) TYPE=InnoDB;
|
9
10
|
|
10
11
|
CREATE TABLE `groups` (
|
11
12
|
`id` int(11) NOT NULL auto_increment,
|
12
|
-
`name` varchar(50) NOT NULL,
|
13
|
+
`name` varchar(50) NOT NULL UNIQUE,
|
13
14
|
`description` varchar(50) default NULL,
|
15
|
+
`some_int` integer default NULL,
|
16
|
+
`some_float` float default NULL,
|
17
|
+
`some_bool` boolean default NULL,
|
14
18
|
PRIMARY KEY (`id`)
|
15
19
|
) TYPE=InnoDB;
|
16
20
|
|
@@ -21,10 +25,34 @@ CREATE TABLE `group_memberships` (
|
|
21
25
|
PRIMARY KEY (`id`)
|
22
26
|
) TYPE=InnoDB;
|
23
27
|
|
28
|
+
CREATE TABLE `adjectives` (
|
29
|
+
`id` int(11) NOT NULL auto_increment,
|
30
|
+
`name` varchar(255),
|
31
|
+
PRIMARY KEY (`id`)
|
32
|
+
) TYPE=InnoDB;
|
33
|
+
|
34
|
+
CREATE TABLE `adjectives_fun_users` (
|
35
|
+
`fun_user_id` int(11) NOT NULL,
|
36
|
+
`adjective_id` int(11) NOT NULL,
|
37
|
+
PRIMARY KEY (`fun_user_id`,`adjective_id`)
|
38
|
+
) TYPE=InnoDB;
|
39
|
+
|
40
|
+
|
24
41
|
CREATE TABLE `group_tag` (
|
25
42
|
`id` int(11) NOT NULL auto_increment,
|
26
43
|
`name` varchar(50) NOT NULL,
|
27
44
|
`group_id` int(11) NOT NULL,
|
45
|
+
`referenced_group_id` int(11) NULL UNIQUE,
|
28
46
|
PRIMARY KEY (`id`)
|
29
47
|
) TYPE=InnoDB;
|
30
48
|
|
49
|
+
ALTER TABLE `group_tag`
|
50
|
+
ADD FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE;
|
51
|
+
|
52
|
+
ALTER TABLE `group_tag`
|
53
|
+
ADD FOREIGN KEY (`referenced_group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE;
|
54
|
+
|
55
|
+
ALTER TABLE `adjectives_fun_users`
|
56
|
+
ADD FOREIGN KEY (`adjective_id`) REFERENCES `adjectives` (`id`) ON DELETE CASCADE;
|
57
|
+
|
58
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
CREATE TABLE "fun_users" (
|
2
|
+
"id" SERIAL NOT NULL,
|
3
|
+
"type" varchar(255) NOT NULL,
|
4
|
+
"firstname" varchar(50) NOT NULL,
|
5
|
+
"lastname" varchar(50) NOT NULL,
|
6
|
+
"login" varchar(50) NOT NULL,
|
7
|
+
"email" varchar(50) NULL,
|
8
|
+
PRIMARY KEY ("id")
|
9
|
+
);
|
10
|
+
|
11
|
+
CREATE TABLE "groups" (
|
12
|
+
"id" SERIAL NOT NULL,
|
13
|
+
"name" varchar(50) NOT NULL UNIQUE,
|
14
|
+
"description" varchar(50) default NULL,
|
15
|
+
"some_int" integer default NULL,
|
16
|
+
"some_float" float default NULL,
|
17
|
+
"some_bool" boolean default NULL,
|
18
|
+
PRIMARY KEY ("id")
|
19
|
+
);
|
20
|
+
|
21
|
+
CREATE TABLE "group_memberships" (
|
22
|
+
"id" SERIAL,
|
23
|
+
"fun_user_id" int NOT NULL,
|
24
|
+
"group_id" int NOT NULL,
|
25
|
+
PRIMARY KEY ("id")
|
26
|
+
);
|
27
|
+
|
28
|
+
CREATE TABLE "adjectives" (
|
29
|
+
"id" SERIAL,
|
30
|
+
"name" varchar(255),
|
31
|
+
PRIMARY KEY ("id")
|
32
|
+
);
|
33
|
+
|
34
|
+
CREATE TABLE "adjectives_fun_users" (
|
35
|
+
"fun_user_id" int NOT NULL,
|
36
|
+
"adjective_id" int NOT NULL,
|
37
|
+
PRIMARY KEY ("fun_user_id","adjective_id")
|
38
|
+
);
|
39
|
+
|
40
|
+
CREATE TABLE "group_tag" (
|
41
|
+
"id" SERIAL NOT NULL,
|
42
|
+
"name" varchar(50) NOT NULL,
|
43
|
+
"group_id" int NOT NULL,
|
44
|
+
"referenced_group_id" int NULL UNIQUE,
|
45
|
+
PRIMARY KEY ("id")
|
46
|
+
);
|
47
|
+
|
48
|
+
ALTER TABLE "group_tag"
|
49
|
+
ADD FOREIGN KEY ("group_id") REFERENCES "groups" ("id") ON DELETE CASCADE;
|
50
|
+
|
51
|
+
ALTER TABLE "group_tag"
|
52
|
+
ADD FOREIGN KEY ("referenced_group_id") REFERENCES "groups" ("id") ON DELETE CASCADE;
|
53
|
+
|
54
|
+
ALTER TABLE "adjectives_fun_users"
|
55
|
+
ADD FOREIGN KEY ("adjective_id") REFERENCES "adjectives" ("id") ON DELETE CASCADE;
|
56
|
+
|
data/test/fixtures/fun_users.yml
CHANGED
data/test/fixtures/group_tag.yml
CHANGED
data/test/fixtures/groups.yml
CHANGED
File without changes
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'abstract_unit'
|
2
|
+
require 'pp'
|
2
3
|
|
3
4
|
class InvisibleModelAccessTest < Test::Unit::TestCase
|
4
5
|
fixtures :fun_users, :groups, :group_memberships, :group_tag
|
@@ -15,14 +16,22 @@ class InvisibleModelAccessTest < Test::Unit::TestCase
|
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
18
|
-
def
|
19
|
-
|
19
|
+
def test_sti
|
20
|
+
x = FunUserPlus.find(:all)
|
21
|
+
assert x.inject {|n,v| n &= v.class == FunUserPlus}, "Wrong object class in FunUserPlus.find(:all)"
|
22
|
+
plus = x.first
|
23
|
+
assert_not_nil plus
|
24
|
+
assert plus.is_a?(FunUser)
|
25
|
+
assert plus.class == FunUserPlus
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_new
|
29
|
+
assert group = Group.new(:name => 'New Group')
|
20
30
|
assert_equal Group, group.class
|
21
31
|
end
|
22
32
|
|
23
33
|
def test_update
|
24
|
-
assert @group.update_attributes(:name => 'Group 1')
|
25
|
-
assert_equal Group, @group.class
|
34
|
+
assert @group.update_attributes(:name => 'Group 1'), "Couldn't update:\n#{str=""; @group.errors.each_full { |msg| str += "#{msg}\n" }; str }"
|
26
35
|
end
|
27
36
|
|
28
37
|
def test_delete
|
@@ -31,7 +40,26 @@ class InvisibleModelAccessTest < Test::Unit::TestCase
|
|
31
40
|
|
32
41
|
def test_validations
|
33
42
|
group = Group.new
|
34
|
-
|
35
|
-
|
43
|
+
group.description = "x"*100
|
44
|
+
group.some_int = 99.9
|
45
|
+
group.some_float = "bah"
|
46
|
+
# Active record seems to interpolate booleans anyway to either true, false or nil...
|
47
|
+
# group.some_bool = "xxx" => false (!)
|
48
|
+
|
49
|
+
assert !group.valid?, "Group should not be valid"
|
50
|
+
[:name, :description, :some_int, :some_float].each do |x|
|
51
|
+
assert_not_nil group.errors[x], "Failed on #{x}=[#{group.send(x)}], it should be invalid"
|
52
|
+
end
|
53
|
+
|
54
|
+
group = Group.new
|
55
|
+
group.name = "name"
|
56
|
+
group.description = "x"*49
|
57
|
+
group.some_int = 99
|
58
|
+
group.some_float = 99.9
|
59
|
+
group.some_bool = true
|
60
|
+
assert group.valid?, "Group should be valid"
|
61
|
+
|
62
|
+
group.name = @group.name
|
63
|
+
assert !group.valid?, "Groups should have unique names"
|
36
64
|
end
|
37
|
-
end
|
65
|
+
end
|
@@ -1,27 +1,52 @@
|
|
1
1
|
require 'abstract_unit'
|
2
2
|
|
3
3
|
class InvisibleModelAssocTest < Test::Unit::TestCase
|
4
|
-
fixtures :fun_users, :groups, :group_memberships
|
4
|
+
fixtures :fun_users, :groups, :group_memberships, :group_tag, :adjectives, :adjectives_fun_users
|
5
5
|
|
6
6
|
def setup
|
7
7
|
@group = groups(:first)
|
8
|
+
@group_tag = group_tag(:first)
|
8
9
|
@user = fun_users(:first)
|
9
10
|
@membership = group_memberships(:first_first)
|
10
11
|
end
|
11
12
|
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
def test_hatbm
|
14
|
+
assert @user.adjectives == [adjectives(:first)]
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_fk
|
18
|
+
|
19
|
+
gt = GroupTag.find(1)
|
20
|
+
|
21
|
+
# Not using FKs
|
22
|
+
g = gt.group
|
23
|
+
assert g.class == Group
|
24
|
+
assert g.id == 1
|
25
|
+
|
26
|
+
# Using FKs
|
27
|
+
g = gt.referenced_group
|
28
|
+
assert g.class == Group
|
29
|
+
assert g.id == 1
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_has_many
|
16
34
|
assert_equal [@membership], @group.group_memberships
|
35
|
+
assert_equal @group, @membership.group
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_has_one
|
39
|
+
assert_equal @group, @group_tag.referenced_group
|
40
|
+
assert_equal @group_tag, @group.group_tag_as_referenced_group
|
17
41
|
end
|
18
42
|
|
19
43
|
def test_belongs_to
|
20
44
|
assert_equal @user, @membership.fun_user
|
21
45
|
assert_equal @group, @membership.group
|
22
|
-
GroupTag.find(:all, :conditions => ['group_id = ?', @group.id]).
|
23
|
-
|
24
|
-
|
46
|
+
manual_result = GroupTag.find(:all, :conditions => ['group_tag.group_id = ?', @group.id]) #.sort{|a,b| a.id <=> b.id}
|
47
|
+
auto_result = @group.group_tags #.sort{|a,b| a.id <=> b.id}
|
48
|
+
assert manual_result == auto_result, "[#{manual_result.join(',')}] != [#{auto_result.join(',')}]"
|
49
|
+
|
25
50
|
end
|
26
51
|
|
27
52
|
def test_indirect
|
@@ -29,14 +54,4 @@ class InvisibleModelAssocTest < Test::Unit::TestCase
|
|
29
54
|
assert_equal [@group], @user.groups
|
30
55
|
end
|
31
56
|
|
32
|
-
|
33
|
-
#def test_more_indirect
|
34
|
-
# group_tags = GroupTag.find(:all, :conditions => ['group_id = ?', @group.id])
|
35
|
-
# assert_equal group_tags, @user.group_tags
|
36
|
-
#end
|
37
|
-
|
38
|
-
#def test_more_indirect_via_belongs_to
|
39
|
-
# @group_tag = group_tag(:first)
|
40
|
-
# assert_equal [@user], @group_tag.fun_users
|
41
|
-
#end
|
42
|
-
end
|
57
|
+
end
|
@@ -2,6 +2,10 @@ require 'abstract_unit'
|
|
2
2
|
|
3
3
|
class InvisibleModelClassesTest < Test::Unit::TestCase
|
4
4
|
|
5
|
+
def setup
|
6
|
+
|
7
|
+
end
|
8
|
+
|
5
9
|
def test_available
|
6
10
|
assert_not_nil Group
|
7
11
|
assert_not_nil FunUser
|
@@ -16,4 +20,4 @@ class InvisibleModelClassesTest < Test::Unit::TestCase
|
|
16
20
|
assert_equal 'group_tag', GroupTag.table_name
|
17
21
|
end
|
18
22
|
|
19
|
-
end
|
23
|
+
end
|
data/website/index.html
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
<style>
|
12
12
|
|
13
13
|
</style>
|
14
|
+
<script type="text/javascript" src="version-raw.js"></script>
|
14
15
|
<script type="text/javascript">
|
15
16
|
window.onload = function() {
|
16
17
|
settings = {
|
@@ -24,6 +25,8 @@
|
|
24
25
|
}
|
25
26
|
var versionBox = new curvyCorners(settings, document.getElementById("version"));
|
26
27
|
versionBox.applyCornersToAll();
|
28
|
+
|
29
|
+
document.getElementById("version_num").innerHTML = version;
|
27
30
|
}
|
28
31
|
</script>
|
29
32
|
</head>
|
@@ -33,9 +36,20 @@
|
|
33
36
|
<h1>Dr Nic’s Magic Models</h1>
|
34
37
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/magicmodels"; return false'>
|
35
38
|
Get Version
|
36
|
-
<a href="http://rubyforge.org/projects/magicmodels" class="numbers"
|
39
|
+
<a id="version_num" href="http://rubyforge.org/projects/magicmodels" class="numbers"></a>
|
37
40
|
</div>
|
38
|
-
<
|
41
|
+
<h2>News alert</h2>
|
42
|
+
|
43
|
+
|
44
|
+
<p>Assocations now generated using <a href="foreignkeys.html">Foreign Keys</a> too!</p>
|
45
|
+
|
46
|
+
|
47
|
+
<p>Now… on with the magic show!
|
48
|
+
<br />
|
49
|
+
<br /></p>
|
50
|
+
|
51
|
+
|
52
|
+
<blockquote>
|
39
53
|
<strong>conjure</strong> 1. To create events that appear to be magical<br />
|
40
54
|
- <a href="http://www.dcopperfield.com/">David Copperfield</a> website
|
41
55
|
</blockquote>
|
@@ -155,7 +169,7 @@ with:
|
|
155
169
|
<pre class="syntax">
|
156
170
|
<span class="ident">create_table</span> <span class="symbol">:groups</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">t</span><span class="punct">|</span>
|
157
171
|
<span class="ident">t</span><span class="punct">.</span><span class="ident">column</span> <span class="symbol">:name</span><span class="punct">,</span> <span class="symbol">:string</span><span class="punct">,</span> <span class="symbol">:null</span> <span class="punct">=></span> <span class="constant">false</span>
|
158
|
-
<span class="ident">t</span><span class="punct">.</span><span class="ident">column</span> <span class="symbol">:description</span><span class="punct">,</span> <span class="symbol">:
|
172
|
+
<span class="ident">t</span><span class="punct">.</span><span class="ident">column</span> <span class="symbol">:description</span><span class="punct">,</span> <span class="symbol">:string</span>
|
159
173
|
<span class="keyword">end</span>
|
160
174
|
</pre></p>
|
161
175
|
|
@@ -357,9 +371,15 @@ other stories and things.</p>
|
|
357
371
|
<p>Comments are welcome. Send an email to <a href="mailto:drnicwilliams@gmail.com">Dr Nic Williams</a>
|
358
372
|
or via his blog at <a href="http://www.drnicwilliams.com">http://www.drnicwilliams.com</a></p>
|
359
373
|
<p class="coda">
|
360
|
-
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>,
|
374
|
+
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 20th September 2006<br>
|
361
375
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
362
376
|
</p>
|
363
377
|
</div>
|
378
|
+
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
379
|
+
</script>
|
380
|
+
<script type="text/javascript">
|
381
|
+
_uacct = "UA-567811-3";
|
382
|
+
urchinTracker();
|
383
|
+
</script>
|
364
384
|
</body>
|
365
385
|
</html>
|
data/website/index.txt
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
h1. Dr Nic's Magic Models
|
2
2
|
|
3
|
+
h2. News alert
|
4
|
+
|
5
|
+
Assocations now generated using "Foreign Keys":foreignkeys.html too!
|
6
|
+
|
7
|
+
Now... on with the magic show!
|
8
|
+
<br />
|
9
|
+
<br />
|
10
|
+
|
3
11
|
<blockquote>
|
4
12
|
*conjure* 1. To create events that appear to be magical<br />
|
5
13
|
- "David Copperfield":http://www.dcopperfield.com/ website
|
@@ -102,7 +110,7 @@ with:
|
|
102
110
|
<pre syntax="ruby">
|
103
111
|
create_table :groups do |t|
|
104
112
|
t.column :name, :string, :null => false
|
105
|
-
t.column :description, :
|
113
|
+
t.column :description, :string
|
106
114
|
end
|
107
115
|
</pre>
|
108
116
|
|
data/website/template.js
ADDED
data/website/template.rhtml
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
<style>
|
12
12
|
|
13
13
|
</style>
|
14
|
+
<script type="text/javascript" src="version-raw.js"></script>
|
14
15
|
<script type="text/javascript">
|
15
16
|
window.onload = function() {
|
16
17
|
settings = {
|
@@ -24,6 +25,8 @@
|
|
24
25
|
}
|
25
26
|
var versionBox = new curvyCorners(settings, document.getElementById("version"));
|
26
27
|
versionBox.applyCornersToAll();
|
28
|
+
|
29
|
+
document.getElementById("version_num").innerHTML = version;
|
27
30
|
}
|
28
31
|
</script>
|
29
32
|
</head>
|
@@ -33,7 +36,7 @@
|
|
33
36
|
<h1><%= title %></h1>
|
34
37
|
<div id="version" class="clickable" onclick='document.location = "<%= download %>"; return false'>
|
35
38
|
Get Version
|
36
|
-
<a href="<%= download %>" class="numbers"
|
39
|
+
<a id="version_num" href="<%= download %>" class="numbers"></a>
|
37
40
|
</div>
|
38
41
|
<%= body %>
|
39
42
|
<p class="coda">
|
@@ -41,5 +44,11 @@
|
|
41
44
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
42
45
|
</p>
|
43
46
|
</div>
|
47
|
+
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
48
|
+
</script>
|
49
|
+
<script type="text/javascript">
|
50
|
+
_uacct = "UA-567811-3";
|
51
|
+
urchinTracker();
|
52
|
+
</script>
|
44
53
|
</body>
|
45
54
|
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
h1. Version JS file
|
data/website/version.js
ADDED
data/website/version.txt
ADDED