Create a gem named archiver
which will add archive
, restore
and archived?
methods to an ActiveRecord model.
- Create a gem named archiver.
- Ensure it has a valid gemspec file.
- Add
activerecord
as a runtime dependency.
The archive
, restore
, and archived?
methods should work based on the archived_at
field on the active record model. The gem's assumption is that it will be used on models that already have the archived_at
field.
- Add
archive
method to setarchived_at
to the current time. - Add
restore
method to setarchived_at
tonil
. - Add
archived?
method to check ifarchived_at
is set.
We will use this repo to test functionality:
Note: cd into the repo after cloning and run rm -rf .git
to avoid git submodule usage
- Clone the repo and get it running.
- Add the
factory_bot
gem to the development and test group. - Ensure the
factory_bot
gem is greater than or equal to5.0.0
but less than6.0.0
. - Add the
archiver
gem as a local gem and include the Archiver functionality into the Article model. - Make sure that the added Archiver functionality works in the blog by testing it on articles.