LancePants97 / market_money_2405

1 stars 0 forks source link

Schema Setup #4

Closed LancePants97 closed 3 months ago

LancePants97 commented 3 months ago

Run rails db:{drop,create,migrate,seed} and you may see lots of output including some warnings/errors from pg_restore that you can ignore

Run rails db:schema:dump . Then, check to see that your schema.rb exists and has the proper tables/attributes that match the data in Postico. You can do the following to check to see if you have set up rails to effectively communicate with the database.

  1. Add a market.rb file to your models directory
  2. Create a Market class that inherits from ApplicationRecord
  3. run rails c to jump into your rails console.
  4. run Market.first to see the object: ##<Market id: 322458, name: "14&U Farmers' Market", street: "1400 U Street NW ", city: "Washington", county: "District of Columbia", state: "District of Columbia", zip: "20009", lat: "38.9169984", lon: "-77.0320505">
  5. run Market.last to see the object: #<Market id: 331081, name: "Year-Round Cedar City Farmer's Market ", street: "905 South Main Street at IFA", city: "Cedar City", county: nil, state: "Utah", zip: "84720", lat: "37.6619", lon: "-113.069">

If this all checks out you should be good to go!