Git Product home page Git Product logo

cat-tinder-backend-instructors-charlean-austin-sarah's Introduction

Rails Set up Commands

$ rails new cat-tinder-backend -d postgresql -T $ cd cat-tinder-backend $ git remote add origin https://github.com/learn-academy-2022-charlie/cat-tinder-backend-instructors-charlean-austin-sarah.git $ git checkout -b main $ bundle add rspec-rails $ rails generate rspec:install $ rails db:create $ rails s $ git add . $ git commit -m "Initial Commit with RSPEC and PostgreSQL" $ git push origin main $ git checkout -b backend-structure $ rails generate resource Cat name:string age:integer enjoys:text image:text $ rails db:migrate $ rspec spec

Seeds

cats = [
  {
    name: 'Ketchup',
    age: 5,
    enjoys: 'Home Fried Burgers', 
    image: 'https://thiscatdoesnotexist.com/'
  },
  {
    name: 'Dog',
    age: 3,
    enjoys: 'Chasing cats', 
    image: 'https://www.shutterstock.com/image-photo/fitness-cat-lifting-heavy-big-dumbbell-283555859'
  },
  {
    name: 'Bolo',
    age: 7,
    enjoys: 'yarn', 
    image: 'https://unsplash.com/photos/XMxn_NkvnR0'
  },
  {
    name: 'Snowflake',
    age: 12,
    enjoys: 'Climbing trees', 
    image: 'https://s1.1zoom.me/big0/603/Cats_Snow_Black_Paws_514726_1280x720.jpg'
  }
]

cats.each do |attributes|
  Cat.create attributes
end

p Cat.all
p "Cat's Seeds worked out fine"
  • Each time we run rails db:seed we will end up adding the mock data to our data base. SO if we ran it three times we would have 3 of each cat in our database.

Cors

$ bundle add rack-cors

  • Check that gem "rack-cors", "~> 1.1" was installed at the end of the GEMFILE
  • create the cors.rb file in the initializers folder
  • add the code to the cors.rb file $ bundle

Endpoints

Setup

  • Stub all the restful API methods

cat-tinder-backend-instructors-charlean-austin-sarah's People

Contributors

walkertexas-coder 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.