arel-helpers 2.2.0 → 2.12.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.
- checksums.yaml +5 -5
- data/Gemfile +1 -12
- data/README.md +45 -2
- data/Rakefile +2 -2
- data/arel-helpers.gemspec +16 -14
- data/lib/arel-helpers.rb +2 -1
- data/lib/arel-helpers/aliases.rb +21 -0
- data/lib/arel-helpers/join_association.rb +190 -10
- data/lib/arel-helpers/query_builder.rb +16 -1
- data/lib/arel-helpers/version.rb +1 -1
- data/spec/aliases_spec.rb +40 -0
- data/spec/arel_table_spec.rb +11 -13
- data/spec/env/models.rb +7 -6
- data/spec/internal/config/database.yml +3 -0
- data/spec/internal/db/combustion_test.sqlite +0 -0
- data/spec/internal/db/schema.rb +34 -0
- data/spec/internal/log/test.log +2979 -0
- data/spec/join_association_spec.rb +115 -41
- data/spec/query_builder_spec.rb +36 -17
- data/spec/spec_helper.rb +10 -20
- metadata +101 -14
- data/History.txt +0 -35
- data/spec/env.rb +0 -44
- data/spec/env/migrations.rb +0 -69
data/History.txt
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
== 1.0.0
|
2
|
-
|
3
|
-
* Birthday! Includes join_association and arel_table helpers.
|
4
|
-
|
5
|
-
== 1.1.0
|
6
|
-
|
7
|
-
* Adding the QueryBuilder class.
|
8
|
-
|
9
|
-
== 1.2.0
|
10
|
-
|
11
|
-
* Adding Rails 4 support.
|
12
|
-
|
13
|
-
== 2.0.0
|
14
|
-
|
15
|
-
* Turning JoinAssociation into an ActiveSupport::Concern (breaks backwards compatibility).
|
16
|
-
|
17
|
-
== 2.0.1
|
18
|
-
|
19
|
-
* Define ArelHelpers.join_association so people can use join_association functionality without relying on autoloading. (@peeja, github issue #8)
|
20
|
-
|
21
|
-
== 2.0.2
|
22
|
-
|
23
|
-
* Fix issue causing CollectionProxy#[] to return Arel::Attribute objects instead of model instances. See https://github.com/camertron/arel-helpers/pull/11
|
24
|
-
|
25
|
-
== 2.1.0
|
26
|
-
|
27
|
-
* Adding support for Rails 4.2 (@hasghari, github issue #12)
|
28
|
-
|
29
|
-
== 2.1.1
|
30
|
-
|
31
|
-
* Fixing issue causing ArelTable instances to get returned when accessing records inside an ActiveRecord::Relation. (@svoynow, #18)
|
32
|
-
|
33
|
-
== 2.2.0
|
34
|
-
|
35
|
-
* Adding polymorphic join support for Rails 4.2.
|
data/spec/env.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require 'env/models'
|
4
|
-
require 'env/migrations'
|
5
|
-
|
6
|
-
module ArelHelpers
|
7
|
-
class Env
|
8
|
-
class << self
|
9
|
-
|
10
|
-
def db_dir
|
11
|
-
@db_dir ||= File.join(File.dirname(File.dirname(__FILE__)), "tmp")
|
12
|
-
end
|
13
|
-
|
14
|
-
def db_file
|
15
|
-
@db_file ||= File.join(db_dir, "test.sqlite3")
|
16
|
-
end
|
17
|
-
|
18
|
-
def establish_connection
|
19
|
-
ActiveRecord::Base.establish_connection(
|
20
|
-
:adapter => "sqlite3",
|
21
|
-
:database => db_file
|
22
|
-
)
|
23
|
-
end
|
24
|
-
|
25
|
-
def migrate
|
26
|
-
CreatePostsTable.new.change
|
27
|
-
CreateCommentsTable.new.change
|
28
|
-
CreateAuthorsTable.new.change
|
29
|
-
CreateFavoritesTable.new.change
|
30
|
-
CreateCollabPostsTable.new.change
|
31
|
-
CreateCardsTable.new.change
|
32
|
-
CreateCardLocationsTable.new.change
|
33
|
-
CreateLocationsTable.new.change
|
34
|
-
CreateCommunityTicketsTable.new.change
|
35
|
-
end
|
36
|
-
|
37
|
-
def reset
|
38
|
-
File.unlink(db_file) if File.exist?(db_file)
|
39
|
-
FileUtils.mkdir_p(db_dir)
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/spec/env/migrations.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
class CreatePostsTable < ActiveRecord::Migration
|
4
|
-
def change
|
5
|
-
create_table :posts do |t|
|
6
|
-
t.column :title, :string
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
class CreateCommentsTable < ActiveRecord::Migration
|
12
|
-
def change
|
13
|
-
create_table :comments do |t|
|
14
|
-
t.references :post
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class CreateAuthorsTable < ActiveRecord::Migration
|
20
|
-
def change
|
21
|
-
create_table :authors do |t|
|
22
|
-
t.references :comment
|
23
|
-
t.references :collab_posts
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
class CreateFavoritesTable < ActiveRecord::Migration
|
29
|
-
def change
|
30
|
-
create_table :favorites do |t|
|
31
|
-
t.references :post
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
class CreateCollabPostsTable < ActiveRecord::Migration
|
37
|
-
def change
|
38
|
-
create_table :collab_posts do |t|
|
39
|
-
t.references :authors
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
class CreateCardsTable < ActiveRecord::Migration
|
45
|
-
def change
|
46
|
-
create_table :cards
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
class CreateCardLocationsTable < ActiveRecord::Migration
|
51
|
-
def change
|
52
|
-
create_table :card_locations do |t|
|
53
|
-
t.references :location
|
54
|
-
t.references :card, polymorphic: true
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
class CreateLocationsTable < ActiveRecord::Migration
|
60
|
-
def change
|
61
|
-
create_table :locations
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
class CreateCommunityTicketsTable < ActiveRecord::Migration
|
66
|
-
def change
|
67
|
-
create_table :community_tickets
|
68
|
-
end
|
69
|
-
end
|