Giter VIP home page Giter VIP logo

rails-mini-course-sprint1-mod4-student--starter's Introduction

Ruby on Rails - Ruby & Ruby on Rails Basics - Packaging Ruby Code - Project

Create and Use a Gem

Create a gem named archiver which will add archive, restore and archived? methods to an ActiveRecord model.

Step One - Create Gem

  1. Create a gem named archiver.
  2. Ensure it has a valid gemspec file.
  3. Add activerecord as a runtime dependency.

Step Two - Add functionality

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.

  1. Add archive method to set archived_at to the current time.
  2. Add restore method to set archived_at to nil.
  3. Add archived? method to check if archived_at is set.

Step Three - Add Archiver to Simple Blog

We will use this repo to test functionality:

Starter Repo

Note: cd into the repo after cloning and run rm -rf .git to avoid git submodule usage

  1. Clone the repo and get it running.
  2. Add the factory_bot gem to the development and test group.
  3. Ensure the factory_bot gem is greater than or equal to 5.0.0 but less than 6.0.0.
  4. Add the archiver gem as a local gem and include the Archiver functionality into the Article model.
  5. Make sure that the added Archiver functionality works in the blog by testing it on articles.

rails-mini-course-sprint1-mod4-student--starter's People

Contributors

bnbry avatar mattmccarley avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.