Comments (2)
Thanks for the issue!
Possibly should be done as a separate gem in addition to discard?
I'd prefer this.
I'd like to keep discard really small, and not have it grow much bigger than it is now. (It really doesn't do much, it's more a set of conventions than a real tool).
I'm open to making changes which make a mongoid integration easier so long as they don't add much complexity. (If much complexity is required, it would probably be best for users of both AR and mongoid to just have a totally separate fork)
adjust the scopes to work with Mongoid
I'd be okay with moving Discard::Model::ClassMethods
into a different class like Discard::Scopes
. With this we could add something like extend Discard::Scopes if self < ActiveRecord::Base
to the included
block (perhaps something more explicit, but I do want to follow SemVer strictly and not change that API)
changing the
activerecord
dependency toactivesupport
Changing it to activemodel
is 👍 by me, so long as we also make the change to the scopes I describe above (the scopes do make ActiveRecord required).
add Mongoid field
field discard_column, type: Time
in the included block of Discard::Model - needs to be done in a way that it doesn't break the ActiveRecord version
I'm not familiar with Mongoid or libraries for it, but I feel like it would be best to just explicitly declare the field. If declaring it implicitly is desired, as long as it is in the Mongoid-specific gem, that's 👍
from discard.
i know this issue is closed for a while, but today i ran in this problem 😁 (i had discard in gem list and it loads active record and i searched a while why activerecord is laoded - it maked me crazy 😁)
i forked and changed the gem. The changes are about 6 lines, only one scope didn't work with mongoid.
if it's ok for @jhawthorn i would like to create a merge request for the changes.
from discard.
Related Issues (20)
- Support for discarded_by? HOT 3
- Unable to declare scope :kept as per the readme.md HOT 2
- discard has_and_belongs_to_many association HOT 1
- Discard callbacks don't work with observers HOT 3
- NoMethodError (undefined method `undiscarded?' ... HOT 4
- is discard_all! working on version 1.1.0 HOT 2
- after_discard_commit HOT 1
- All new records are discarded use-case HOT 2
- Run callbacks inside of the same transaction HOT 5
- Rails 7 is here, why not drop the upper version dependency? HOT 1
- Support for Rails 7.0.0 HOT 2
- Add the ability to use `dependent: :discard` in associations HOT 1
- Nil when finding has_one association HOT 2
- how is the integration with papertrail? HOT 1
- dependent: :discard HOT 12
- Sequel Support HOT 1
- guard on discard HOT 1
- `self.class.discard_column` as a boolean `is_discarded` for "if" and use `updated_at` for "when" HOT 1
- `def undiscard` doesn't follow `return false` pattern HOT 1
- .discarded query HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discard.