I'm in the process of creating a rails API for scheduling appointments. I'm worrying about making a generic app version first, and then I'm going to make it in to an API, as I havn't done that before.
I've been generating 4-5 scaffolds (rails generate scaffold _____ title:string description: text)
THEN running rake dbmigrate.
When I go to view the file on my local host, while running my rails server I get this error: (unfortunately I can't post images yet with my rep)
No route matches [GET] "/c4cc2"
Rails.root: /Users/Jack/Desktop/Project/CareCloudAttempt2/C4CC2
Application Trace | Framework Trace | Full Trace Routes
Routes match in priority from top to bottom
Helper HTTP Verb Path Controller#Action Path / Url
end_times_path GET /end_times(.:format) end_times#index POST /end_times(.:format) end_times#create new_end_time_path GET /end_times/new(.:format) end_times#new edit_end_time_path GET /end_times/:id/edit(.:format) end_times#edit end_time_path GET /end_times/:id(.:format) end_times#show PATCH /end_times/:id(.:format) end_times#update PUT /end_times/:id(.:format) end_times#update DELETE /end_times/:id(.:format) end_times#destroy start_times_path GET /start_times(.:format) start_times#index POST /start_times(.:format) start_times#create
I've also tried entering the name of the routes after my URL
Here are my routes:
```
Rails.application.routes.draw do resources :end_times
resources :start_times
resources :comments
resources :last_names
resources :first_names
end
```
I was wondering if maybe I needed to run rake db:migrate after each time I scaffold, over if it was another issue.
Thanks!
This is not necessary you have run rake db:migrate
after every scaffold
, but you should run rake db:migrate
before perform anything with rails server
. If you have pending
migration
you may not browse your application.
But there is no problem with running rake db:migrate
after every scaffold
.
Migrating after couple of scaffolds is fine, no need to worry there.
What is c4cc2 supposed to be there? Rails looks for resource with that name in routes but isn't finding any. What are you trying to do with that?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.