Skip to content

defmethodinc/CreationShelf-Rails6API-Template

Repository files navigation

Rails 6/API/Postgresql/ActiveAdmin/Devise/RSpec

This is a Def Method Inc. Rails6API template project.

Ruby 2.7.0 - Rails6

Simplified RailsAPI setup with RSpec and ActiveAdmin.

This API is meant to serve data to corresponding template clients:

The term "CreationShelf" is meant to denote a place to put and store "Creations", a Creation being something a duck-type or generic model in a simlar vein to todos or widgets. A Creation is a thing. Users make Creations.

Using this Template

Click the green User this template on the repo's homepage in Github.

Then rename the project.

Contributing/Adding to this Template

This project is managed through Github projects here. Next prioritized items to do are in the "To Do" column.

Find out more about general Github projects here.

Installation

  • clone this repo
  • bundle install
  • bundle exec rails db:create db:migrate db:seed

This will create an AdminUser. Check the seed file for the login info.

Modeling

A variety of modeling choices were made in order to establish some commonly used and important relationships. A User has_many Creations. A Creation has_many Photos. This relationship is "polymorphic", so a Creation has_many Photos as a "holder". Other "holder"(s) can be added. For instance, a Creation may have many Steps one could take to produce said Creation. Each Step could "hold" photos.

Database

This app assumes communication with a Postgres server.

As a Rails project, this app uses ActiveRecord to maintain migrations of the database schema and interact with the databse.

Seeding

A seed file is located at db/seeds.rb. The seed file can be executed to seed your db by running bundle exec rails db:seed

Seeding is written to be idempotent.

It creates an AdminUser, used for logging into the ActiveAdmin interface.

It also creates Users, Creations, and Photos.

ActiveAdmin

ActiveAdmin has been configured. Seed the database then go to the /admin route. Credentials to sign in are in the seed file.

Here one finds a GUI to perform CRUD actions on the models. Some of the views have been customized and this can be found by going to the app/admin directory.

Testing

This app has been built with RSpec.

Other utilities such as FactoryBot for easily building/creating fixture data of the models and Faker for creating fake data for testing have been added as well.

Debugging

Pry has been included as test/development dependencies. Run binding.pry to stop the runtime process at that point and open up a repl. Use the commands next, continue, step to navigate through the breakpoint.

CI

CI is setup with Codeship.

Versioning

API is setup for versioning. All api routes are currently nested in the namespace api/v1/...

JSON Spec

The Json spec has attempted to be followed.

License (MIT)

Copyright © 2020 Def Method

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A basic Rails 6 API with versioning setup, RSpec/FactoryBot/Faker, ActiveAdmin/Devise

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages