Apps 19:48 Good evening, Spence. Today Work on 1wd.tv Yesterday, you said tomorrow. 1 THING TO DO Make a new quick tip video New todo 41° CHICAGO Todo
Oh no! Our experts couldn't answer your question.
Don't worry! We won't leave you hanging. Plus, we're giving you back one question for the inconvenience.
Can you create the view for this app? It is a clone of the extension momentum. You may create more files as needed. All styling must be done in bootstrap. This is a ruby app. the view should be created in the file bob.html.erb.
This is the backend:in ruby on rails:
this is the models:
location:
class Location < ApplicationRecord
has_many :users
validates :city, :longitude, :latitude, presence: true
end
user:
class User < ApplicationRecord
belongs_to :location
validates :email, presence: true, uniqueness: true
validates :first_name, presence: true
validates :last_name, presence: true
end
this is the schema:
ActiveRecord::Schema[7.0].define(version: 2023_03_15_185016) do
create_table "locations", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "city"
t.string "latitude"
t.string "longitude"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", options: "/*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB", force: :cascade do |t|
t.string "first_name"
t.string "last_name"
t.string "email"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "location_id"
end
end
this is the seed:
Location.create!(city: "New York", longitude: 40.7128, latitude: 74.0060)
User.create!(first_name: "Peter", last_name: "Parker", email: "spidey-senses@avengers.com", location_id: Location.first.id)
This is the routes:
Rails.application.routes.draw do
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
# Defines the root path route ("/")
# root "articles#index"
root to: "homepage#index"
get "/andrew", to: "homepage#andrew"
get "/bob", to: "homepage#bob"
get "/alex", to: "homepage#andrew"
get "/charlotte", to: "homepage#charlotte"
end
the route i will work on is "bob"
this is the controller:
class HomepageController < ApplicationController
def index
end
def andrew
end
def bob
end
def alex
end
def charlotte
end
end
my controller is "bob"