uuid_associations-active_record 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +27 -0
  5. data/Appraisals +24 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +37 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/gemfiles/.bundle/config +2 -0
  13. data/gemfiles/active_record_4.2.gemfile +8 -0
  14. data/gemfiles/active_record_5.0.gemfile +8 -0
  15. data/gemfiles/active_record_5.1.gemfile +8 -0
  16. data/gemfiles/active_record_5.2.gemfile +8 -0
  17. data/gemfiles/active_record_edge.gemfile +8 -0
  18. data/lib/uuid_associations/active_record/inline.rb +5 -0
  19. data/lib/uuid_associations/active_record/method_definitions.rb +20 -0
  20. data/lib/uuid_associations/active_record/railtie.rb +15 -0
  21. data/lib/uuid_associations/active_record/relationship_definitions/base.rb +47 -0
  22. data/lib/uuid_associations/active_record/relationship_definitions/belongs_to.rb +25 -0
  23. data/lib/uuid_associations/active_record/relationship_definitions/has_many.rb +25 -0
  24. data/lib/uuid_associations/active_record/version.rb +5 -0
  25. data/lib/uuid_associations/active_record.rb +5 -0
  26. data/spec/spec_helper.rb +27 -0
  27. data/spec/support/models/comment.rb +3 -0
  28. data/spec/support/models/pet.rb +5 -0
  29. data/spec/support/models/post.rb +5 -0
  30. data/spec/support/models/team.rb +5 -0
  31. data/spec/support/models/user.rb +7 -0
  32. data/spec/support/schema.rb +52 -0
  33. data/spec/uuid_associations/belongs_to_spec.rb +19 -0
  34. data/spec/uuid_associations/has_and_belongs_to_many_spec.rb +39 -0
  35. data/spec/uuid_associations/has_many_spec.rb +25 -0
  36. data/uuid_associations-active_record.gemspec +30 -0
  37. metadata +194 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6961ceb501c186f2db2b6f47a5c8519dd67479d4568e8d538ce1005eaa73db13
4
+ data.tar.gz: cc6fc2bfabc4a25a866f62e1de271fa6ce3cbb98e1404cb9890ee9ecb84940d3
5
+ SHA512:
6
+ metadata.gz: d0284a2a018162316c3698bac28c82b699fcc864c0cffd693809211d15ae009f231b2c8e963cef2b46c77ca32c664e1848769a343febe554786f2937eb91e38c
7
+ data.tar.gz: fd35ddf1320b3806f811ef923b488fe9e5062df6c823f57edbe940dcc45586f163d15d6bc91bab0a97f72cf365a92c38af86c1610dabc2e7bfdc7417801ca180
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.lock
10
+ *.gem
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,27 @@
1
+ ---
2
+ language: ruby
3
+ sudo: false
4
+ cache: bundler
5
+
6
+ rvm:
7
+ - 2.2.10
8
+ - 2.3.7
9
+ - 2.4.4
10
+ - 2.5.1
11
+
12
+ gemfile:
13
+ - gemfiles/active_record_4.2.gemfile
14
+ - gemfiles/active_record_5.0.gemfile
15
+ - gemfiles/active_record_5.1.gemfile
16
+ - gemfiles/active_record_5.2.gemfile
17
+ - gemfiles/active_record_edge.gemfile
18
+
19
+ matrix:
20
+ include:
21
+ - gemfile: gemfiles/active_record_4.2.gemfile
22
+ rvm: 2.1.10
23
+ exclude:
24
+ - gemfile: gemfiles/active_record_edge.gemfile
25
+ rvm: 2.2.10
26
+ - gemfile: gemfiles/active_record_edge.gemfile
27
+ rvm: 2.3.7
data/Appraisals ADDED
@@ -0,0 +1,24 @@
1
+ appraise 'active_record_4.2' do
2
+ gem 'sqlite3'
3
+ gem 'activerecord', github: 'rails/rails', branch: '4-2-stable'
4
+ end
5
+
6
+ appraise 'active_record_5.0' do
7
+ gem 'sqlite3'
8
+ gem 'activerecord', github: 'rails/rails', branch: '5-0-stable'
9
+ end
10
+
11
+ appraise 'active_record_5.1' do
12
+ gem 'sqlite3'
13
+ gem 'activerecord', github: 'rails/rails', branch: '5-1-stable'
14
+ end
15
+
16
+ appraise 'active_record_5.2' do
17
+ gem 'sqlite3'
18
+ gem 'activerecord', github: 'rails/rails', branch: '5-2-stable'
19
+ end
20
+
21
+ appraise 'active_record_edge' do
22
+ gem 'sqlite3'
23
+ gem 'activerecord', github: 'rails/rails', branch: 'master'
24
+ end
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Mario Celi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # UuidAssociations::ActiveRecord
2
+ [![Build Status](https://travis-ci.org/mcelicalderon/uuid_associations-active_record.svg?branch=master)](https://travis-ci.org/mcelicalderon/uuid_associations-active_record)
3
+ [![Gem Version](https://badge.fury.io/rb/uuid_associations-active_record.svg)](https://badge.fury.io/rb/uuid_associations-active_record)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'uuid_associations-active_record'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install uuid_associations-active_record
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/uuid_associations-active_record.
34
+
35
+ ## License
36
+
37
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "uuid_associations/active_record"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "sqlite3"
6
+ gem "activerecord", github: "rails/rails", branch: "4-2-stable"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "sqlite3"
6
+ gem "activerecord", github: "rails/rails", branch: "5-0-stable"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "sqlite3"
6
+ gem "activerecord", github: "rails/rails", branch: "5-1-stable"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "sqlite3"
6
+ gem "activerecord", github: "rails/rails", branch: "5-2-stable"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "sqlite3"
6
+ gem "activerecord", github: "rails/rails", branch: "master"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,5 @@
1
+ require 'active_record'
2
+ require 'active_record/associations'
3
+ require 'uuid_associations/active_record/method_definitions'
4
+
5
+ ::ActiveRecord::Associations::ClassMethods.prepend UuidAssociations::ActiveRecord::MethodDefinitions
@@ -0,0 +1,20 @@
1
+ require 'uuid_associations/active_record/relationship_definitions/belongs_to'
2
+ require 'uuid_associations/active_record/relationship_definitions/has_many'
3
+
4
+ module UuidAssociations
5
+ module ActiveRecord
6
+ module MethodDefinitions
7
+ def has_many(name, scope = nil, **options, &extension)
8
+ original_payload = super(name, scope, options, &extension)
9
+ RelationshipDefinitions::HasMany.define_accesors_for(self, original_payload, name)
10
+ end
11
+
12
+ def belongs_to(name, scope = nil, **options)
13
+ original_payload = super(name, scope, options)
14
+ return original_payload if original_payload.key?('left_side')
15
+
16
+ RelationshipDefinitions::BelongsTo.define_accesors_for(self, original_payload, name)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,15 @@
1
+ require 'uuid_associations/active_record/method_definitions'
2
+
3
+ module UuidAssociations
4
+ module ActiveRecord
5
+ class Railtie < Rails::Railtie
6
+ initializer 'uuid_associations.apply_extension' do |app|
7
+ ActiveSupport.on_load(:active_record) do
8
+ ::ActiveRecord::Associations.eager_load!
9
+
10
+ extend UuidAssociations::ActiveRecord::MethodDefinitions
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,47 @@
1
+ module UuidAssociations
2
+ module ActiveRecord
3
+ module RelationshipDefinitions
4
+ class Base
5
+ def self.define_accesors_for(klass, payload, name)
6
+ new(klass, payload, name).call
7
+ end
8
+
9
+ def initialize(klass, payload, name)
10
+ @klass = klass
11
+ @payload = payload
12
+ @name = name.to_s
13
+ end
14
+
15
+ def call
16
+ reflection = find_reflection(payload)
17
+ association_class_name = reflection.class_name
18
+
19
+ define_accesors(klass, association_class_name) if uuid_column?(association_class_name)
20
+
21
+ payload
22
+ end
23
+
24
+ private
25
+
26
+ attr_reader :payload, :klass, :name
27
+
28
+ def find_reflection(payload)
29
+ payload[name]
30
+ end
31
+
32
+ def table_name_from_class_name(class_name)
33
+ class_name.underscore.pluralize
34
+ end
35
+
36
+ def uuid_column?(association_class_name)
37
+ table_name = table_name_from_class_name(association_class_name)
38
+ return false unless ::ActiveRecord::Base.connection.tables.include?(table_name)
39
+
40
+ ::ActiveRecord::Base.connection.columns(table_name).any? do |column|
41
+ column.name == 'uuid'
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,25 @@
1
+ require 'uuid_associations/active_record/relationship_definitions/base'
2
+
3
+ module UuidAssociations
4
+ module ActiveRecord
5
+ module RelationshipDefinitions
6
+ class BelongsTo < Base
7
+ private
8
+
9
+ def define_accesors(klass, association_class_name)
10
+ klass.class_eval <<-CODE, __FILE__, __LINE__ + 1
11
+ def #{name}_uuid=(uuid)
12
+ self.#{name}_id = #{association_class_name}.find_by!(uuid: uuid).id
13
+ end
14
+ CODE
15
+
16
+ klass.class_eval <<-CODE, __FILE__, __LINE__ + 1
17
+ def #{name}_uuid
18
+ #{name}.uuid
19
+ end
20
+ CODE
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ require 'uuid_associations/active_record/relationship_definitions/base'
2
+
3
+ module UuidAssociations
4
+ module ActiveRecord
5
+ module RelationshipDefinitions
6
+ class HasMany < Base
7
+ private
8
+
9
+ def define_accesors(klass, association_class_name)
10
+ klass.class_eval <<-CODE, __FILE__, __LINE__ + 1
11
+ def #{name.singularize}_uuids=(uuids)
12
+ self.#{name.singularize}_ids = #{association_class_name}.where(uuid: uuids).pluck(:id)
13
+ end
14
+ CODE
15
+
16
+ klass.class_eval <<-CODE, __FILE__, __LINE__ + 1
17
+ def #{name.singularize}_uuids
18
+ #{name}.pluck(:uuid)
19
+ end
20
+ CODE
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ module UuidAssociations
2
+ module ActiveRecord
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ if defined?(Rails::Railtie)
2
+ require 'uuid_associations/active_record/railtie'
3
+ else
4
+ require 'uuid_associations/active_record/inline'
5
+ end
@@ -0,0 +1,27 @@
1
+ require 'pry'
2
+ require 'bundler/setup'
3
+ require 'uuid_associations/active_record'
4
+ require 'support/schema'
5
+ require 'support/models/team'
6
+ require 'support/models/user'
7
+ require 'support/models/post'
8
+ require 'support/models/comment'
9
+
10
+ RSpec.configure do |config|
11
+ # Enable flags like --only-failures and --next-failure
12
+ config.example_status_persistence_file_path = '.rspec_status'
13
+
14
+ # Disable RSpec exposing methods globally on `Module` and `main`
15
+ config.disable_monkey_patching!
16
+
17
+ config.expect_with :rspec do |c|
18
+ c.syntax = :expect
19
+ end
20
+
21
+ config.around do |example|
22
+ ActiveRecord::Base.transaction do
23
+ example.run
24
+ raise ActiveRecord::Rollback
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ class Comment < ActiveRecord::Base
2
+ belongs_to :post, required: false
3
+ end
@@ -0,0 +1,5 @@
1
+ class Pet < ActiveRecord::Base
2
+ has_and_belongs_to_many :users
3
+
4
+ validates :name, presence: true
5
+ end
@@ -0,0 +1,5 @@
1
+ class Post < ActiveRecord::Base
2
+ belongs_to :user, required: false
3
+
4
+ has_many :comments
5
+ end
@@ -0,0 +1,5 @@
1
+ class Team < ActiveRecord::Base
2
+ has_and_belongs_to_many :users
3
+
4
+ validates :name, presence: true
5
+ end
@@ -0,0 +1,7 @@
1
+ class User < ActiveRecord::Base
2
+ has_and_belongs_to_many :teams
3
+
4
+ has_many :posts
5
+
6
+ validates :name, presence: true
7
+ end
@@ -0,0 +1,52 @@
1
+ require 'active_record'
2
+
3
+ ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
4
+
5
+ ActiveRecord::Schema.define version: 0 do
6
+ create_table :teams do |t|
7
+ t.string :name
8
+ t.string :uuid
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ create_table :teams_users, foreign_key: false do |t|
14
+ t.integer :user_id, null: false
15
+ t.integer :team_id, null: false
16
+ end
17
+
18
+ create_table :users do |t|
19
+ t.string :name
20
+ t.string :uuid
21
+
22
+ t.timestamps
23
+ end
24
+
25
+ create_table :pets_users, foreign_key: false do |t|
26
+ t.integer :user_id, null: false
27
+ t.integer :pet_id, null: false
28
+ end
29
+
30
+ create_table :pets do |t|
31
+ t.string :name
32
+ t.string :uuid
33
+
34
+ t.timestamps
35
+ end
36
+
37
+ create_table :posts do |t|
38
+ t.belongs_to :user, foreign_key: { on_delete: :cascade }
39
+ t.string :uuid
40
+ t.string :content
41
+
42
+ t.timestamps
43
+ end
44
+
45
+ create_table :comments do |t|
46
+ t.belongs_to :post, foreign_key: { on_delete: :cascade }
47
+ t.string :uuid
48
+ t.string :body
49
+
50
+ t.timestamps
51
+ end
52
+ end
@@ -0,0 +1,19 @@
1
+ RSpec.describe 'belongs_to associations' do
2
+ let(:user) { User.create!(name: 'Alice', uuid: SecureRandom.uuid) }
3
+
4
+ describe 'writers' do
5
+ it 'defines association_uuid=' do
6
+ post = Post.create!(user_uuid: user.uuid, content: 'my first comment')
7
+
8
+ expect(post.user_id).to eq(user.id)
9
+ end
10
+ end
11
+
12
+ describe 'readers' do
13
+ let(:post) { Post.create!(content: 'test', user: user) }
14
+
15
+ it 'defines association_uuid' do
16
+ expect(post.user_uuid).to eq(user.uuid)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,39 @@
1
+ RSpec.describe 'has_and_belongs_to_many associations' do
2
+ let(:user) { User.create!(name: 'Alice', uuid: SecureRandom.uuid) }
3
+ let(:team) { Team.create!(name: 'My Team', uuid: SecureRandom.uuid) }
4
+ let(:teams) do
5
+ (1..10).map { |i| Team.create!(name: "Team #{i}", uuid: SecureRandom.uuid) }
6
+ end
7
+ let(:users) do
8
+ (1..10).map { |i| User.create!(name: "User #{i}", uuid: SecureRandom.uuid) }
9
+ end
10
+
11
+ describe 'writers' do
12
+ it 'defines association_uuids= on left model' do
13
+ user.team_uuids = teams.map(&:uuid)
14
+
15
+ expect(user.teams.map(&:name)).to match_array(teams.map(&:name))
16
+ end
17
+
18
+ it 'defines association_uuids= on right model' do
19
+ team.user_uuids = users.map(&:uuid)
20
+
21
+ expect(team.users.map(&:name)).to match_array(users.map(&:name))
22
+ end
23
+ end
24
+
25
+ describe 'readers' do
26
+ before do
27
+ user.update(team_ids: teams.map(&:id))
28
+ team.update(user_ids: users.map(&:id))
29
+ end
30
+
31
+ it 'defines association_uuids on left model' do
32
+ expect(user.team_uuids).to match_array(teams.map(&:uuid))
33
+ end
34
+
35
+ it 'defines association_uuids on right model' do
36
+ expect(team.user_uuids).to match_array(users.map(&:uuid))
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,25 @@
1
+ RSpec.describe 'has_many associations' do
2
+ let(:post) { Post.create!(content: 'test', uuid: SecureRandom.uuid) }
3
+ let(:user) { User.create!(name: 'Alice', uuid: SecureRandom.uuid) }
4
+ let(:comment) { Comment.create!(body: 'My comment', uuid: SecureRandom.uuid) }
5
+
6
+ describe 'writers' do
7
+ before do
8
+ user.post_uuids = [post.uuid]
9
+ post.comment_uuids = [comment.uuid]
10
+ end
11
+
12
+ it 'defines association_uuids=' do
13
+ expect(user.post_ids).to eq(Post.pluck(:id))
14
+ expect(post.comment_ids).to eq(Comment.pluck(:id))
15
+ end
16
+ end
17
+
18
+ describe 'readers' do
19
+ before { Post.create!(content: 'test', user: user, uuid: SecureRandom.uuid) }
20
+
21
+ it 'defines association_uuids' do
22
+ expect(user.post_uuids).to eq(Post.pluck(:uuid))
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,30 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'uuid_associations/active_record/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'uuid_associations-active_record'
7
+ spec.version = UuidAssociations::ActiveRecord::VERSION
8
+ spec.authors = ['Mario Celi']
9
+ spec.email = ['mcelicalderon@gmail.com']
10
+
11
+ spec.summary = 'Helper methods for UUID associations in Active Record'
12
+ spec.description = 'Adds association_uuids= method on has_many and has_and_belongs_to_many associations'
13
+ spec.homepage = 'https://github.com/mcelicalderon/uuid_associations-active_record'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.test_files = spec.files.grep(%r{^spec\/})
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_dependency 'activerecord', '>= 4.2', '< 6.0'
23
+
24
+ spec.add_development_dependency 'appraisal', '~> 2.0'
25
+ spec.add_development_dependency 'bundler', '~> 1.16'
26
+ spec.add_development_dependency 'pry', '~> 0.11.3'
27
+ spec.add_development_dependency 'rake', '~> 10.0'
28
+ spec.add_development_dependency 'rspec', '~> 3.0'
29
+ spec.add_development_dependency 'sqlite3', '~> 1.3'
30
+ end
metadata ADDED
@@ -0,0 +1,194 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: uuid_associations-active_record
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mario Celi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-10-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '6.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '4.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '6.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: appraisal
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '2.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.16'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.16'
61
+ - !ruby/object:Gem::Dependency
62
+ name: pry
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: 0.11.3
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: 0.11.3
75
+ - !ruby/object:Gem::Dependency
76
+ name: rake
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '10.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '10.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rspec
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '3.0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '3.0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: sqlite3
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '1.3'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '1.3'
117
+ description: Adds association_uuids= method on has_many and has_and_belongs_to_many
118
+ associations
119
+ email:
120
+ - mcelicalderon@gmail.com
121
+ executables: []
122
+ extensions: []
123
+ extra_rdoc_files: []
124
+ files:
125
+ - ".gitignore"
126
+ - ".rspec"
127
+ - ".travis.yml"
128
+ - Appraisals
129
+ - Gemfile
130
+ - LICENSE.txt
131
+ - README.md
132
+ - Rakefile
133
+ - bin/console
134
+ - bin/setup
135
+ - gemfiles/.bundle/config
136
+ - gemfiles/active_record_4.2.gemfile
137
+ - gemfiles/active_record_5.0.gemfile
138
+ - gemfiles/active_record_5.1.gemfile
139
+ - gemfiles/active_record_5.2.gemfile
140
+ - gemfiles/active_record_edge.gemfile
141
+ - lib/uuid_associations/active_record.rb
142
+ - lib/uuid_associations/active_record/inline.rb
143
+ - lib/uuid_associations/active_record/method_definitions.rb
144
+ - lib/uuid_associations/active_record/railtie.rb
145
+ - lib/uuid_associations/active_record/relationship_definitions/base.rb
146
+ - lib/uuid_associations/active_record/relationship_definitions/belongs_to.rb
147
+ - lib/uuid_associations/active_record/relationship_definitions/has_many.rb
148
+ - lib/uuid_associations/active_record/version.rb
149
+ - spec/spec_helper.rb
150
+ - spec/support/models/comment.rb
151
+ - spec/support/models/pet.rb
152
+ - spec/support/models/post.rb
153
+ - spec/support/models/team.rb
154
+ - spec/support/models/user.rb
155
+ - spec/support/schema.rb
156
+ - spec/uuid_associations/belongs_to_spec.rb
157
+ - spec/uuid_associations/has_and_belongs_to_many_spec.rb
158
+ - spec/uuid_associations/has_many_spec.rb
159
+ - uuid_associations-active_record.gemspec
160
+ homepage: https://github.com/mcelicalderon/uuid_associations-active_record
161
+ licenses:
162
+ - MIT
163
+ metadata: {}
164
+ post_install_message:
165
+ rdoc_options: []
166
+ require_paths:
167
+ - lib
168
+ required_ruby_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ requirements: []
179
+ rubyforge_project:
180
+ rubygems_version: 2.7.7
181
+ signing_key:
182
+ specification_version: 4
183
+ summary: Helper methods for UUID associations in Active Record
184
+ test_files:
185
+ - spec/spec_helper.rb
186
+ - spec/support/models/comment.rb
187
+ - spec/support/models/pet.rb
188
+ - spec/support/models/post.rb
189
+ - spec/support/models/team.rb
190
+ - spec/support/models/user.rb
191
+ - spec/support/schema.rb
192
+ - spec/uuid_associations/belongs_to_spec.rb
193
+ - spec/uuid_associations/has_and_belongs_to_many_spec.rb
194
+ - spec/uuid_associations/has_many_spec.rb