jorahood-ar-extensions 0.9.2.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/ChangeLog +145 -0
- data/README +167 -0
- data/Rakefile +79 -0
- data/config/database.yml +7 -0
- data/config/database.yml.template +7 -0
- data/config/mysql.schema +72 -0
- data/config/postgresql.schema +39 -0
- data/db/migrate/generic_schema.rb +96 -0
- data/db/migrate/mysql_schema.rb +31 -0
- data/db/migrate/oracle_schema.rb +5 -0
- data/db/migrate/version.rb +4 -0
- data/init.rb +31 -0
- data/lib/ar-extensions/create_and_update.rb +509 -0
- data/lib/ar-extensions/csv.rb +309 -0
- data/lib/ar-extensions/delete.rb +143 -0
- data/lib/ar-extensions/extensions.rb +506 -0
- data/lib/ar-extensions/finder_options.rb +275 -0
- data/lib/ar-extensions/finders.rb +94 -0
- data/lib/ar-extensions/foreign_keys.rb +70 -0
- data/lib/ar-extensions/fulltext.rb +62 -0
- data/lib/ar-extensions/import.rb +352 -0
- data/lib/ar-extensions/insert_select.rb +178 -0
- data/lib/ar-extensions/synchronize.rb +30 -0
- data/lib/ar-extensions/temporary_table.rb +124 -0
- data/lib/ar-extensions/union.rb +204 -0
- data/lib/ar-extensions/version.rb +9 -0
- data/tests/connections/native_mysql/connection.rb +16 -0
- data/tests/connections/native_oracle/connection.rb +16 -0
- data/tests/connections/native_postgresql/connection.rb +19 -0
- data/tests/connections/native_sqlite/connection.rb +14 -0
- data/tests/connections/native_sqlite3/connection.rb +14 -0
- data/tests/fixtures/addresses.yml +25 -0
- data/tests/fixtures/books.yml +46 -0
- data/tests/fixtures/developers.yml +20 -0
- data/tests/fixtures/unit/active_record_base_finders/addresses.yml +25 -0
- data/tests/fixtures/unit/active_record_base_finders/books.yml +64 -0
- data/tests/fixtures/unit/active_record_base_finders/developers.yml +20 -0
- data/tests/fixtures/unit/synchronize/books.yml +16 -0
- data/tests/fixtures/unit/to_csv_headers/addresses.yml +8 -0
- data/tests/fixtures/unit/to_csv_headers/developers.yml +6 -0
- data/tests/fixtures/unit/to_csv_with_common_options/addresses.yml +40 -0
- data/tests/fixtures/unit/to_csv_with_common_options/developers.yml +13 -0
- data/tests/fixtures/unit/to_csv_with_common_options/languages.yml +29 -0
- data/tests/fixtures/unit/to_csv_with_common_options/teams.yml +3 -0
- data/tests/fixtures/unit/to_csv_with_default_options/developers.yml +7 -0
- data/tests/models/address.rb +4 -0
- data/tests/models/animal.rb +2 -0
- data/tests/models/book.rb +3 -0
- data/tests/models/cart_item.rb +4 -0
- data/tests/models/developer.rb +8 -0
- data/tests/models/group.rb +3 -0
- data/tests/models/language.rb +5 -0
- data/tests/models/mysql/book.rb +3 -0
- data/tests/models/mysql/test_innodb.rb +3 -0
- data/tests/models/mysql/test_memory.rb +3 -0
- data/tests/models/mysql/test_myisam.rb +3 -0
- data/tests/models/project.rb +2 -0
- data/tests/models/shopping_cart.rb +4 -0
- data/tests/models/team.rb +4 -0
- data/tests/models/topic.rb +13 -0
- data/tests/mysql/test_create_and_update.rb +290 -0
- data/tests/mysql/test_delete.rb +142 -0
- data/tests/mysql/test_finder_options.rb +121 -0
- data/tests/mysql/test_finders.rb +29 -0
- data/tests/mysql/test_import.rb +354 -0
- data/tests/mysql/test_insert_select.rb +173 -0
- data/tests/mysql/test_mysql_adapter.rb +45 -0
- data/tests/mysql/test_union.rb +81 -0
- data/tests/oracle/test_adapter.rb +14 -0
- data/tests/postgresql/test_adapter.rb +14 -0
- metadata +147 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
first_developers_address:
|
|
2
|
+
id: 1
|
|
3
|
+
developer_id: 1
|
|
4
|
+
address: 1111 SomeWhere Rd.
|
|
5
|
+
city: Someville
|
|
6
|
+
state: MI
|
|
7
|
+
zip: 49548
|
|
8
|
+
|
|
9
|
+
second_developers_address:
|
|
10
|
+
id: 2
|
|
11
|
+
developer_id: 2
|
|
12
|
+
address: 2222 SomeWhere Rd.
|
|
13
|
+
city: Someville
|
|
14
|
+
state: MI
|
|
15
|
+
zip: 49548
|
|
16
|
+
|
|
17
|
+
second_developers_beachhouse_address:
|
|
18
|
+
id: 3
|
|
19
|
+
developer_id: 2
|
|
20
|
+
address: 2223 North Shore Dr.
|
|
21
|
+
city: Charlevoix
|
|
22
|
+
state: MI
|
|
23
|
+
zip: 49720
|
|
24
|
+
|
|
25
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
first:
|
|
2
|
+
id: 1
|
|
3
|
+
title: "The Voyage of Jerle Shannara: Antrax"
|
|
4
|
+
publisher: Del Rey
|
|
5
|
+
author_name: Terry Brooks
|
|
6
|
+
second:
|
|
7
|
+
id: 2
|
|
8
|
+
title: "The Voyage of Jerle Shannara: Ilse Witch"
|
|
9
|
+
publisher: Del Rey
|
|
10
|
+
author_name: Terry Brooks
|
|
11
|
+
for_sale: false
|
|
12
|
+
third:
|
|
13
|
+
id: 3
|
|
14
|
+
title: "The Voyage of Jerle Shannara: Jarka Ruus"
|
|
15
|
+
publisher: Del Rey
|
|
16
|
+
author_name: Terry Brooks
|
|
17
|
+
fourth:
|
|
18
|
+
id: 4
|
|
19
|
+
title: "The Voyage of Jerle Shannara: Morgwar"
|
|
20
|
+
publisher: Del Rey
|
|
21
|
+
author_name: Terry Brooks
|
|
22
|
+
fifth:
|
|
23
|
+
id: 5
|
|
24
|
+
title: "Circle At Center"
|
|
25
|
+
publisher: "ACE Fantasy"
|
|
26
|
+
author_name: Douglas Niles
|
|
27
|
+
sixth:
|
|
28
|
+
id: 6
|
|
29
|
+
title: WISDOM for the way
|
|
30
|
+
publisher: Hallmark Books
|
|
31
|
+
author_name: Charles R. Swindoll
|
|
32
|
+
seventh:
|
|
33
|
+
id: 7
|
|
34
|
+
title: High Tech Startup
|
|
35
|
+
publisher: Free Press
|
|
36
|
+
author_name: John L. Neshem
|
|
37
|
+
eighth:
|
|
38
|
+
id: 8
|
|
39
|
+
title: The Two Swords
|
|
40
|
+
publisher: Forgotten Realms
|
|
41
|
+
author_name: R.A. Salvatore
|
|
42
|
+
ninth:
|
|
43
|
+
id: 9
|
|
44
|
+
title: Come Thirsty
|
|
45
|
+
publisher: W Publishing Group
|
|
46
|
+
author_name: Max Lucado
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
first_developer:
|
|
2
|
+
id: 1
|
|
3
|
+
name: Zach Dennis
|
|
4
|
+
salary: 1
|
|
5
|
+
created_at:
|
|
6
|
+
updated_at:
|
|
7
|
+
|
|
8
|
+
second_developer:
|
|
9
|
+
id: 2
|
|
10
|
+
name: John Doe
|
|
11
|
+
salary: 2
|
|
12
|
+
created_at:
|
|
13
|
+
updated_at:
|
|
14
|
+
|
|
15
|
+
null_developer:
|
|
16
|
+
id: 3
|
|
17
|
+
name: NULL
|
|
18
|
+
salary: 3
|
|
19
|
+
created_at:
|
|
20
|
+
updated_at:
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
first_developers_address:
|
|
2
|
+
id: 1
|
|
3
|
+
developer_id: 1
|
|
4
|
+
address: 1111 SomeWhere Rd.
|
|
5
|
+
city: Someville
|
|
6
|
+
state: MI
|
|
7
|
+
zip: 49548
|
|
8
|
+
|
|
9
|
+
second_developers_address:
|
|
10
|
+
id: 2
|
|
11
|
+
developer_id: 2
|
|
12
|
+
address: 2222 SomeWhere Rd.
|
|
13
|
+
city: Someville
|
|
14
|
+
state: MI
|
|
15
|
+
zip: 49548
|
|
16
|
+
|
|
17
|
+
second_developers_beachhouse_address:
|
|
18
|
+
id: 3
|
|
19
|
+
developer_id: 2
|
|
20
|
+
address: 2223 North Shore Dr.
|
|
21
|
+
city: Charlevoix
|
|
22
|
+
state: MI
|
|
23
|
+
zip: 49720
|
|
24
|
+
|
|
25
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
first:
|
|
2
|
+
id: 1
|
|
3
|
+
title: "The Voyage of Jerle Shannara: Antrax"
|
|
4
|
+
publisher: Del Rey
|
|
5
|
+
author_name: Terry Brooks
|
|
6
|
+
created_at: 2007-03-12 21:38:04
|
|
7
|
+
created_on: 2007-03-12 21:38:04
|
|
8
|
+
second:
|
|
9
|
+
id: 2
|
|
10
|
+
title: "The Voyage of Jerle Shannara: Ilse Witch"
|
|
11
|
+
publisher: Del Rey
|
|
12
|
+
author_name: Terry Brooks
|
|
13
|
+
created_at: 2007-01-10 21:20:00
|
|
14
|
+
created_on: 2007-01-10 21:20:00
|
|
15
|
+
for_sale: false
|
|
16
|
+
third:
|
|
17
|
+
id: 3
|
|
18
|
+
title: "The Voyage of Jerle Shannara: Jarka Ruus"
|
|
19
|
+
publisher: Del Rey
|
|
20
|
+
author_name: Terry Brooks
|
|
21
|
+
created_at: 2006-03-12 21:38:04
|
|
22
|
+
created_on: 2006-03-12 21:38:04
|
|
23
|
+
fourth:
|
|
24
|
+
id: 4
|
|
25
|
+
title: "The Voyage of Jerle Shannara: Morgwar"
|
|
26
|
+
publisher: Del Rey
|
|
27
|
+
author_name: Terry Brooks
|
|
28
|
+
created_at: 2005-03-12 21:38:04
|
|
29
|
+
created_on: 2005-03-12 21:38:04
|
|
30
|
+
fifth:
|
|
31
|
+
id: 5
|
|
32
|
+
title: "Circle At Center"
|
|
33
|
+
publisher: "ACE Fantasy"
|
|
34
|
+
author_name: Douglas Niles
|
|
35
|
+
created_at: 2004-03-12 21:38:04
|
|
36
|
+
created_on: 2004-03-12 21:38:04
|
|
37
|
+
sixth:
|
|
38
|
+
id: 6
|
|
39
|
+
title: WISDOM for the way
|
|
40
|
+
publisher: Hallmark Books
|
|
41
|
+
author_name: Charles R. Swindoll
|
|
42
|
+
created_at: 2004-01-12 21:38:04
|
|
43
|
+
created_on: 2004-01-12 21:38:04
|
|
44
|
+
seventh:
|
|
45
|
+
id: 7
|
|
46
|
+
title: High Tech Startup
|
|
47
|
+
publisher: Free Press
|
|
48
|
+
author_name: John L. Neshem
|
|
49
|
+
created_at: 2003-01-12 21:38:04
|
|
50
|
+
created_on: 2003-12-12 21:38:04
|
|
51
|
+
eighth:
|
|
52
|
+
id: 8
|
|
53
|
+
title: The Two Swords
|
|
54
|
+
publisher: Forgotten Realms
|
|
55
|
+
author_name: R.A. Salvatore
|
|
56
|
+
created_at: 2002-01-12 21:38:04
|
|
57
|
+
created_on: 2002-03-12 21:38:04
|
|
58
|
+
ninth:
|
|
59
|
+
id: 9
|
|
60
|
+
title: Come Thirsty
|
|
61
|
+
publisher: W Publishing Group
|
|
62
|
+
author_name: Max Lucado
|
|
63
|
+
created_at: 2001-01-12 21:38:04
|
|
64
|
+
created_on: 2001-01-12 21:38:04
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
first_developer:
|
|
2
|
+
id: 1
|
|
3
|
+
name: Zach Dennis
|
|
4
|
+
salary: 1
|
|
5
|
+
created_at:
|
|
6
|
+
updated_at:
|
|
7
|
+
|
|
8
|
+
second_developer:
|
|
9
|
+
id: 2
|
|
10
|
+
name: John Doe
|
|
11
|
+
salary: 2
|
|
12
|
+
created_at:
|
|
13
|
+
updated_at:
|
|
14
|
+
|
|
15
|
+
null_developer:
|
|
16
|
+
id: 3
|
|
17
|
+
name: NULL
|
|
18
|
+
salary: 3
|
|
19
|
+
created_at:
|
|
20
|
+
updated_at:
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
first:
|
|
2
|
+
id: 1
|
|
3
|
+
title: "Book1"
|
|
4
|
+
publisher: Publisher1
|
|
5
|
+
author_name: Oscar The Grouch
|
|
6
|
+
second:
|
|
7
|
+
id: 2
|
|
8
|
+
title: "Book2"
|
|
9
|
+
publisher: Publisher
|
|
10
|
+
author_name: Big Bird
|
|
11
|
+
third:
|
|
12
|
+
id: 3
|
|
13
|
+
title: "Book3"
|
|
14
|
+
publisher: Publisher
|
|
15
|
+
author_name: Elmo
|
|
16
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
first_developers_address:
|
|
2
|
+
id: 1
|
|
3
|
+
developer_id: 1
|
|
4
|
+
address: 1111 SomeWhere Rd.
|
|
5
|
+
city: Someville
|
|
6
|
+
state: MI
|
|
7
|
+
zip: 49548
|
|
8
|
+
|
|
9
|
+
first_developer_second_address:
|
|
10
|
+
id: 2
|
|
11
|
+
developer_id: 1
|
|
12
|
+
address: 2222 SomeWhere Rd.
|
|
13
|
+
city: Someville
|
|
14
|
+
state: MI
|
|
15
|
+
zip: 49548
|
|
16
|
+
|
|
17
|
+
second_developers_address:
|
|
18
|
+
id: 3
|
|
19
|
+
developer_id: 2
|
|
20
|
+
address: 1111 SomeWhere Rd.
|
|
21
|
+
city: Someville
|
|
22
|
+
state: MI
|
|
23
|
+
zip: 49548
|
|
24
|
+
|
|
25
|
+
second_developer_second_address:
|
|
26
|
+
id: 4
|
|
27
|
+
developer_id: 2
|
|
28
|
+
address: 2222 SomeWhere Rd.
|
|
29
|
+
city: Someville
|
|
30
|
+
state: MI
|
|
31
|
+
zip: 49548
|
|
32
|
+
|
|
33
|
+
second_developer_third_address:
|
|
34
|
+
id: 5
|
|
35
|
+
developer_id: 2
|
|
36
|
+
address: 3333 SomeWhere Rd.
|
|
37
|
+
city: Someville
|
|
38
|
+
state: MI
|
|
39
|
+
zip: 49548
|
|
40
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
ruby:
|
|
2
|
+
id: 1
|
|
3
|
+
name: Ruby
|
|
4
|
+
developer_id: 1
|
|
5
|
+
|
|
6
|
+
perl:
|
|
7
|
+
id: 2
|
|
8
|
+
name: Perl
|
|
9
|
+
developer_id: 1
|
|
10
|
+
|
|
11
|
+
java:
|
|
12
|
+
id: 3
|
|
13
|
+
name: Java
|
|
14
|
+
developer_id: 2
|
|
15
|
+
|
|
16
|
+
php:
|
|
17
|
+
id: 4
|
|
18
|
+
name: PHP
|
|
19
|
+
developer_id: 2
|
|
20
|
+
|
|
21
|
+
xml:
|
|
22
|
+
id: 5
|
|
23
|
+
name: XML
|
|
24
|
+
developer_id: 2
|
|
25
|
+
|
|
26
|
+
python:
|
|
27
|
+
id: 6
|
|
28
|
+
name: Python
|
|
29
|
+
developer_id: 2
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class Topic < ActiveRecord::Base
|
|
2
|
+
validates_presence_of :author_name
|
|
3
|
+
has_many :books
|
|
4
|
+
|
|
5
|
+
composed_of :description, :mapping => [ %w(title title), %w(author_name author_name)], :allow_nil => true, :class_name => "TopicDescription"
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class TopicDescription
|
|
9
|
+
attr_reader :title, :author_name
|
|
10
|
+
def initialize(title, author_name)
|
|
11
|
+
@title, @author_name = title, author_name
|
|
12
|
+
end
|
|
13
|
+
end
|