activerecord-ghosts 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d8dc5ffdd3fb04d90505d3c72d29ee3e244eceb3878d01281350c585dcaaa2b6
4
+ data.tar.gz: 77a1e2db341038581297964bf01b01965664f3f88f71daa298b6e7e3d599b253
5
+ SHA512:
6
+ metadata.gz: 545d6e2147b78734a9b2748b1655a8483f979d0eda33c01a3a753fb2058b3fa0d34ca92b62903ca0f42d0b5b649abf7fcc4bdf8d7c3cf75542b223623e4836d3
7
+ data.tar.gz: 9792de752eca66c581f6bd910164261f89c957980e70710782f280da875d2b6e9b27724b0e7310a6d68e4ba079bc2bb2558971dc586c43fd793cbf47559ce1f3
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
4
+ --order random
data/.rubocop.yml ADDED
@@ -0,0 +1,25 @@
1
+ inherit_gem:
2
+ standard: config/base.yml
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 3.4
6
+ NewCops: enable
7
+ Exclude:
8
+ - 'vendor/**/*'
9
+ - 'tmp/**/*'
10
+ - 'bin/**/*'
11
+
12
+ # Allow longer lines in specs
13
+ Layout/LineLength:
14
+ Exclude:
15
+ - 'spec/**/*'
16
+
17
+ # Allow longer blocks in specs
18
+ Metrics/BlockLength:
19
+ Exclude:
20
+ - 'spec/**/*'
21
+
22
+ # Allow longer methods in specs
23
+ Metrics/MethodLength:
24
+ Exclude:
25
+ - 'spec/**/*'
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/standardrb/standard
3
+ ruby_version: 3.4
data/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.0.1] - 2025-08-25
9
+
10
+ ### Added
11
+ - Initial release of ActiveRecord::Ghosts
12
+ - `has_ghosts` method to define ghost sequences on ActiveRecord models
13
+ - Support for range queries that return mix of real and ghost records
14
+ - Enumerator support for infinite sequences
15
+ - Ghost records that inherit `where` conditions from parent relation
16
+ - Performance warnings for unindexed ghost columns
17
+ - Support for Rails 7.0+ and Ruby 3.4+
18
+ - Comprehensive test suite covering Rails and Ruby compatibility
19
+
20
+ ### Features
21
+ - Ghost records behave like AR objects but aren't persisted
22
+ - `ghost?` method to identify ghost records
23
+ - Works with ActiveRecord associations and scopes
24
+ - Efficient batching for large datasets via enumerators
25
+ - Custom inspect output for ghost records
26
+
27
+ ## [0.0.1] - 2025-08-25
28
+
29
+ - Initial release
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Ilya Kovalenko
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/PUBLISHING.md ADDED
@@ -0,0 +1,105 @@
1
+ # Publishing to RubyGems
2
+
3
+ This**Security features implemented:**
4
+
5
+ 1. **Owner-only Releases**: Only `@ilyacoding` can create tags and trigger releases
6
+ 2. **Environment Protection**: Uses `production` environment that requires manual approval
7
+ 3. **Environment Variable**: API key passed as `GEM_HOST_API_KEY` environment variable (RubyGems standard)
8
+ 4. **Secret Isolation**: API key is not exposed in shell commands or logs
9
+ 5. **Tag-only Deployment**: Only deploys on version tags, not on every push
10
+ 6. **Test Before Deploy**: Runs full test suite before publishing
11
+ 7. **Version Validation**: Pre-release checks ensure tag matches code version
12
+ 8. **Code Review**: All changes require code owner approvalnt describes how to publish the activerecord-ghosts gem to RubyGems.
13
+
14
+ ## Prerequisites
15
+
16
+ 1. You need a RubyGems account: https://rubygems.org/sign_up
17
+ 2. Get your API key from: https://rubygems.org/profile/edit
18
+ 3. Add the API key to GitHub Secrets as `RUBYGEMS_API_KEY`
19
+
20
+ ## Security Measures
21
+
22
+ ### Repository Access Control
23
+
24
+ 1. **CODEOWNERS**: All changes require approval from `@ilyacoding`
25
+ 2. **Branch Protection**: Main branch is protected with required reviews
26
+ 3. **Tag Protection**: Only `@ilyacoding` can create version tags
27
+ 4. **Workflow Restrictions**: Only `@ilyacoding` can trigger releases
28
+
29
+ ### GitHub Repository Setup
30
+
31
+ **Required manual setup** (one-time only):
32
+
33
+ 1. **Branch Protection Rules**: See `.github/BRANCH_PROTECTION.md`
34
+ 2. **Environment Setup**:
35
+ - Create `production` environment
36
+ - Add `@ilyacoding` as required reviewer
37
+ - Set `RUBYGEMS_API_KEY` secret (environment-specific)
38
+ 3. **Tag Protection**: Restrict `v*` tags to repository admins only
39
+
40
+ ### Security features implemented:
41
+
42
+ 1. **Environment Protection**: Uses `production` environment that can require manual approval
43
+ 2. **Environment Variable**: API key passed as `GEM_HOST_API_KEY` environment variable (RubyGems standard)
44
+ 3. **Secret Isolation**: API key is not exposed in shell commands or logs
45
+ 4. **Tag-only Deployment**: Only deploys on version tags, not on every push
46
+ 5. **Test Before Deploy**: Runs full test suite before publishing
47
+
48
+ ### Setting up Environment Protection (Recommended)
49
+
50
+ 1. Go to: Settings → Environments → New environment
51
+ 2. Name it `production`
52
+ 3. Add protection rules:
53
+ - Required reviewers (yourself)
54
+ - Wait timer (optional)
55
+ - Deployment branches: only protected branches
56
+
57
+ ## Publishing Process
58
+
59
+ ### 1. Manual Publishing
60
+
61
+ To publish manually:
62
+
63
+ ```bash
64
+ # Build the gem
65
+ gem build activerecord-ghosts.gemspec
66
+
67
+ # Push to RubyGems (replace YOUR_API_KEY)
68
+ gem push activerecord-ghosts-0.0.1.gem
69
+ ```
70
+
71
+ ### 2. Automated Publishing via GitHub Actions
72
+
73
+ The repository includes GitHub Actions for automated publishing:
74
+
75
+ 1. **Create a new tag:**
76
+ ```bash
77
+ git tag v0.0.1
78
+ git push origin v0.0.1
79
+ ```
80
+
81
+ 2. **The publish action will automatically:**
82
+ - Run tests
83
+ - Build the gem
84
+ - Publish to RubyGems
85
+
86
+ ### 3. Version Updates
87
+
88
+ To release a new version:
89
+
90
+ 1. Update the version in `lib/activerecord/ghosts/version.rb`
91
+ 2. Update `CHANGELOG.md` with new changes
92
+ 3. Commit the changes
93
+ 4. Create a new tag: `git tag vX.Y.Z`
94
+ 5. Push the tag: `git push origin vX.Y.Z`
95
+
96
+ ## GitHub Secrets Setup
97
+
98
+ Go to: Settings → Secrets and variables → Actions → New repository secret
99
+
100
+ **Never commit API keys to code!** Always use GitHub Secrets for sensitive data.
101
+
102
+ ## Workflow Structure
103
+
104
+ - **ci.yml**: Runs tests on every push/PR
105
+ - **publish.yml**: Publishes gem only on version tags with security measures
data/README.md ADDED
@@ -0,0 +1,167 @@
1
+ # ActiveRecord::Ghosts 👻
2
+
3
+ "Virtual rows" for ActiveRecord models.
4
+ Fill in the gaps in your sequencFor best performance, ensure the ghosted column (e.g. `:level`) has an **index**.
5
+ If it doesn't, you'll see a warning:
6
+
7
+ ```
8
+ [activerecord-ghosts] ⚠️ Column :level on progress_levels has no leading index. Ghost queries may be slow.
9
+ ``` work with **ghost records** that behave like AR objects but aren’t persisted.
10
+
11
+ ---
12
+
13
+ ## ✨ Features
14
+
15
+ - Define a sequence column (like `number`).
16
+ - Query with a range and get **real + ghost records**.
17
+ - Chain with `where` / scopes.
18
+ - Works with `Enumerator` for infinite series.
19
+ - Ghost records respond to `.ghost?`.
20
+
21
+ ---
22
+
23
+ ## 🚀 Installation
24
+
25
+ **Requirements:**
26
+ - Ruby 3.4.0+
27
+ - Rails 7.0+
28
+
29
+ Add to your Gemfile:
30
+
31
+ ```ruby
32
+ gem "activerecord-ghosts"
33
+ ````
34
+
35
+ and run:
36
+
37
+ ```bash
38
+ bundle install
39
+ ```
40
+
41
+ ---
42
+
43
+ ## 🛠 Usage
44
+
45
+ ### 1. Enable ghosts on your model
46
+
47
+ ```ruby
48
+ class ProgressLevel < ApplicationRecord
49
+ belongs_to :user
50
+ has_ghosts :level
51
+ end
52
+ ```
53
+
54
+ ---
55
+
56
+ ### 2. Generate a ghost series
57
+
58
+ ```ruby
59
+ ProgressLevel.ghosts(1..5).map { |level| [level.level, level.ghost?] }
60
+ # => [[1, false], [2, false], [3, true], [4, true], [5, true]]
61
+ ```
62
+
63
+ Here:
64
+
65
+ * Levels `1` and `2` exist in DB → `ghost? == false`
66
+ * Levels `3..5` don't exist → ghost objects (`ghost? == true`)
67
+
68
+ ---
69
+
70
+ ### 3. Combine with conditions
71
+
72
+ For a specific user:
73
+
74
+ ```ruby
75
+ user = User.find(1)
76
+ user.progress_levels.ghosts(1..5).map { |level| [level.level, level.user_id, level.ghost?] }
77
+ # => [
78
+ # [1, 1, false],
79
+ # [2, 1, false],
80
+ # [3, 1, true],
81
+ # [4, 1, true],
82
+ # [5, 1, true]
83
+ # ]
84
+
85
+ # Alternative syntax:
86
+ ProgressLevel.where(user_id: user.id).ghosts(1..5).map { |level| [level.level, level.user_id, level.ghost?] }
87
+ ```
88
+
89
+ Ghosts automatically inherit `where` conditions as defaults.
90
+
91
+ ---
92
+
93
+ ### 4. Infinite series
94
+
95
+ Without arguments, `.ghosts` returns an **Enumerator**:
96
+
97
+ ```ruby
98
+ ProgressLevel.ghosts.take(3).map { |level| [level.level, level.ghost?] }
99
+ # => [[1, false], [2, false], [3, true]]
100
+ ```
101
+
102
+ You can `each`, `each_slice`, etc.
103
+ Records are lazily loaded batch by batch.
104
+
105
+ ---
106
+
107
+ ## ⚠️ Performance note
108
+
109
+ For best performance, ensure the ghosted column (e.g. `:number`) has an **index**.
110
+ If it doesn’t, you’ll see a warning:
111
+
112
+ ```
113
+ [activerecord-ghosts] ⚠️ Column :number on invoices has no leading index. Ghost queries may be slow.
114
+ ```
115
+
116
+ Composite indexes are fine if your ghost column is the **leading** column.
117
+
118
+ ---
119
+
120
+ ## 📦 Development
121
+
122
+ Clone and setup:
123
+
124
+ ```bash
125
+ git clone https://github.com/ilyacoding/activerecord-ghosts
126
+ cd activerecord-ghosts
127
+ bundle install
128
+ ```
129
+
130
+ ## 🚀 Development & Publishing
131
+
132
+ ### Local Development
133
+
134
+ ```bash
135
+ bundle install
136
+ bundle exec rspec
137
+ ```
138
+
139
+ ### Automated Publishing
140
+
141
+ This gem uses **RubyGems.org Trusted Publishing** for secure, automated releases.
142
+
143
+ **Release Process:**
144
+ 1. Update version in `lib/activerecord/ghosts/version.rb`
145
+ 2. Commit and create tag: `git tag v0.1.1 && git push --tags`
146
+ 3. GitHub Actions automatically publishes to RubyGems.org
147
+
148
+ See [TRUSTED_PUBLISHING.md](TRUSTED_PUBLISHING.md) for setup details.
149
+
150
+ ### Running Tests
151
+
152
+ ```bash
153
+ bundle exec rspec
154
+ ```
155
+
156
+ ---
157
+
158
+ ## 📜 License
159
+
160
+ MIT © Ilya Kovalenko
161
+
162
+ ---
163
+
164
+ ## 🤝 Contributing
165
+
166
+ Pull requests welcome!
167
+ By participating you agree to follow the [Code of Conduct](CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "standard/rake"
9
+
10
+ task default: %i[spec standard]
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveRecord
4
+ module Ghosts
5
+ module GhostRecord
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ attr_accessor :_ghost
10
+ end
11
+
12
+ def ghost?
13
+ !!_ghost
14
+ end
15
+
16
+ def inspect
17
+ base = super
18
+ ghost? ? base.sub("#<", "#<ghost ") : base
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "activerecord/ghosts/ghost_record"
4
+
5
+ module ActiveRecord
6
+ module Ghosts
7
+ module HasGhosts
8
+ extend ActiveSupport::Concern
9
+
10
+ class_methods do
11
+ def has_ghosts(field_name, start: 1)
12
+ include ActiveRecord::Ghosts::GhostRecord
13
+
14
+ # ⚠️ Проверка индекса (leading column)
15
+ unless connection.indexes(table_name).any? { |i| i.columns.first == field_name.to_s }
16
+ warn "[activerecord-ghosts] ⚠️ Column :#{field_name} on #{table_name} has no leading index. Ghost queries may be slow."
17
+ end
18
+
19
+ define_singleton_method(:ghosts) do |*args, **opts|
20
+ ghosts_implementation(all, field_name, start, *args, **opts)
21
+ end
22
+
23
+ define_method(:ghosts) do |*args, **opts|
24
+ ghosts_implementation(self, field_name, start, *args, **opts)
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def ghosts_implementation(relation, field_name, start, *args, **opts)
31
+ range = extract_range(args, opts)
32
+
33
+ # 1) Без range → бесконечный Enumerator
34
+ unless range
35
+ return Enumerator.new do |yielder|
36
+ n = start
37
+ loop do
38
+ batch_size = opts.fetch(:batch_size, 100)
39
+ batch_range = (n...(n + batch_size))
40
+
41
+ records = relation.where(field_name => batch_range).index_by(&field_name)
42
+ defaults = relation.where_values_hash.symbolize_keys.merge(opts[:default] || {})
43
+
44
+ batch_range.each do |num|
45
+ rec = records[num] || relation.new(defaults.merge(field_name => num))
46
+ rec._ghost = true unless records[num]
47
+ yielder << rec
48
+ end
49
+
50
+ n += batch_size
51
+ end
52
+ end
53
+ end
54
+
55
+ # 2) С range → фиксированный массив
56
+ records = relation.where(field_name => range).index_by(&field_name)
57
+ defaults = relation.where_values_hash.symbolize_keys.merge(opts[:default] || {})
58
+
59
+ range.map do |num|
60
+ if records[num]
61
+ records[num]
62
+ else
63
+ ghost = relation.new(defaults.merge(field_name => num))
64
+ ghost._ghost = true
65
+ ghost
66
+ end
67
+ end
68
+ end
69
+
70
+ def extract_range(args, opts)
71
+ return args.first if args.first.is_a?(Range)
72
+ return (opts[:from]..opts[:to]) if opts[:from] && opts[:to]
73
+ nil
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveRecord
4
+ module Ghosts
5
+ VERSION = "0.0.1"
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support"
4
+ require "active_support/concern"
5
+ require "active_record"
6
+
7
+ require "activerecord/ghosts/version"
8
+ require "activerecord/ghosts/has_ghosts"
9
+
10
+ module ActiveRecord
11
+ module Ghosts
12
+ end
13
+ end
14
+
15
+ ActiveRecord::Base.include ActiveRecord::Ghosts::HasGhosts
@@ -0,0 +1,6 @@
1
+ module Activerecord
2
+ module Ghosts
3
+ VERSION: String
4
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,193 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activerecord-ghosts
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ilya Kovalenko
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: activerecord
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '6.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '6.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: rspec
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: rspec-rails
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: rails
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '7.0'
61
+ - - "<"
62
+ - !ruby/object:Gem::Version
63
+ version: '9.0'
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '7.0'
71
+ - - "<"
72
+ - !ruby/object:Gem::Version
73
+ version: '9.0'
74
+ - !ruby/object:Gem::Dependency
75
+ name: sqlite3
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '1.4'
81
+ type: :development
82
+ prerelease: false
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '1.4'
88
+ - !ruby/object:Gem::Dependency
89
+ name: database_cleaner-active_record
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ type: :development
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ - !ruby/object:Gem::Dependency
103
+ name: factory_bot
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ type: :development
110
+ prerelease: false
111
+ version_requirements: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ - !ruby/object:Gem::Dependency
117
+ name: rubocop
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '1.21'
123
+ type: :development
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '1.21'
130
+ - !ruby/object:Gem::Dependency
131
+ name: standard
132
+ requirement: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: 1.35.1
137
+ type: :development
138
+ prerelease: false
139
+ version_requirements: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: 1.35.1
144
+ description: ActiveRecord::Ghosts allows you to define a sequence column and query
145
+ with ranges to get real + ghost records. Ghost records behave like AR objects but
146
+ aren't persisted, perfect for filling gaps in sequences like levels, numbers, etc.
147
+ email:
148
+ - a@fromilya.com
149
+ executables: []
150
+ extensions: []
151
+ extra_rdoc_files: []
152
+ files:
153
+ - ".rspec"
154
+ - ".rubocop.yml"
155
+ - ".standard.yml"
156
+ - CHANGELOG.md
157
+ - CODE_OF_CONDUCT.md
158
+ - LICENSE.txt
159
+ - PUBLISHING.md
160
+ - README.md
161
+ - Rakefile
162
+ - lib/activerecord/ghosts.rb
163
+ - lib/activerecord/ghosts/ghost_record.rb
164
+ - lib/activerecord/ghosts/has_ghosts.rb
165
+ - lib/activerecord/ghosts/version.rb
166
+ - sig/activerecord/ghosts.rbs
167
+ homepage: https://github.com/ilyacoding/activerecord-ghosts
168
+ licenses:
169
+ - MIT
170
+ metadata:
171
+ allowed_push_host: https://rubygems.org
172
+ homepage_uri: https://github.com/ilyacoding/activerecord-ghosts
173
+ source_code_uri: https://github.com/ilyacoding/activerecord-ghosts
174
+ changelog_uri: https://github.com/ilyacoding/activerecord-ghosts/blob/main/CHANGELOG.md
175
+ rdoc_options: []
176
+ require_paths:
177
+ - lib
178
+ required_ruby_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ version: 3.4.0
183
+ required_rubygems_version: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ requirements: []
189
+ rubygems_version: 3.6.7
190
+ specification_version: 4
191
+ summary: Virtual rows for ActiveRecord models - fill in the gaps in your sequences
192
+ with ghost records
193
+ test_files: []