Skip to content

kateyzcodes/PATS_v1

 
 

Repository files navigation

67272_PATS_v1_sqlite

This is a basic Rails app that was built as a class demonstration in the spring of 2018 and revised in Spring 2022. This first version of the project is designed help students become more familiar with the basics of the Rails 5.2.6 framework; future versions will add in additional features like searching (straight|phonetic|full-text), polymorphic associations, and interactive javascript interfaces.

The class is Application Design & Development (67-272) and is for students in Information Systems at Carnegie Mellon University. We have posted this code on github in a public directory so that (a) it is readily accessible to students and (b) that students will get a little familiarity with github.com.

This project does require the use of several gems to work properly. Check the Gemfile to see which gems are used. This project also assumes the user is running Ruby 2.6.9 since that is what is used in the course.

Setup

This version of the project requires only a sqlite3 database. After cloning this repo, install all gems with the bundle install on the command line. To set up the database and populate it with realistic sample records, run on the command line rake db:populate. The populate script will remove any old databases, create new development and test databases, run all the migrations to set up the structure, and then create 240 owners with over 450 pets and several thousand visits. (Every run will generate a different set of data and because of the large numbers and the callbacks used, it will take a few minutes.)

To verify the model and controller tests are functioning, simply run rails test on the command line. The SimpleCov gem will create a coverage directory with an index.html file in it; open this file in a web browser to see the coverage provided.

The populate script will also create a vet user to login into the system. The username is 'vet' and the password is 'yodel' -- a tribute to VeggieTales' The Yodeling Veterinarian of the Alps.

If you want to load the testing context into the development database, you can do the following:

  1. if you have previously populated the database, drop it and rerun rails db:migrate to recreate a blank db.
  2. open rails console
  3. type require 'factory_bot_rails' (it will say 'false')
  4. type require './test/contexts' (it will say 'true')
  5. type include Contexts (it will say 'Object')
  6. type in whatever context building method you wish (e.g., create_animals)

But of course, even easier than this would be to just run rake db:contexts and it will drop the existing database, rebuild the schema, and then run the create_all method in the context.

About

A first version of PATS using Rails 7

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 75.6%
  • HTML 16.7%
  • SCSS 3.3%
  • Gherkin 2.8%
  • JavaScript 1.4%
  • CoffeeScript 0.2%