arel-helpers 2.4.0 → 2.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +1 -12
- data/README.md +27 -1
- 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 +161 -13
- 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 +111 -51
- data/spec/query_builder_spec.rb +36 -17
- data/spec/spec_helper.rb +10 -20
- metadata +101 -14
- data/History.txt +0 -43
- data/spec/env.rb +0 -44
- data/spec/env/migrations.rb +0 -71
data/History.txt
DELETED
@@ -1,43 +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.
|
36
|
-
|
37
|
-
== 2.3.0
|
38
|
-
|
39
|
-
* Adding support for Rails 5 (@vkill #24, @camertron #26)
|
40
|
-
|
41
|
-
== 2.4.0
|
42
|
-
|
43
|
-
* Adding support for Rails 5.1 (@hasghari #30)
|
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,71 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
SuperClass = ActiveRecord::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1 ? ActiveRecord::Migration[5.1] : ActiveRecord::Migration
|
4
|
-
|
5
|
-
class CreatePostsTable < SuperClass
|
6
|
-
def change
|
7
|
-
create_table :posts do |t|
|
8
|
-
t.column :title, :string
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class CreateCommentsTable < SuperClass
|
14
|
-
def change
|
15
|
-
create_table :comments do |t|
|
16
|
-
t.references :post
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
class CreateAuthorsTable < SuperClass
|
22
|
-
def change
|
23
|
-
create_table :authors do |t|
|
24
|
-
t.references :comment
|
25
|
-
t.references :collab_posts
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class CreateFavoritesTable < SuperClass
|
31
|
-
def change
|
32
|
-
create_table :favorites do |t|
|
33
|
-
t.references :post
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
class CreateCollabPostsTable < SuperClass
|
39
|
-
def change
|
40
|
-
create_table :collab_posts do |t|
|
41
|
-
t.references :authors
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class CreateCardsTable < SuperClass
|
47
|
-
def change
|
48
|
-
create_table :cards
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
class CreateCardLocationsTable < SuperClass
|
53
|
-
def change
|
54
|
-
create_table :card_locations do |t|
|
55
|
-
t.references :location
|
56
|
-
t.references :card, polymorphic: true
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
class CreateLocationsTable < SuperClass
|
62
|
-
def change
|
63
|
-
create_table :locations
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
class CreateCommunityTicketsTable < SuperClass
|
68
|
-
def change
|
69
|
-
create_table :community_tickets
|
70
|
-
end
|
71
|
-
end
|