I have a Rails app that has only consisted of backend code so far (a little custom workflow engine, Redis, foreman, etc). Today I tried to add the first controller to the application, but I can’t get the new controller to load.
I used:
rails generate controller CollectedData new --no-test-framework
And got back:
create app/controllers/collected_data_controller. rb
route get "collected_data/new"
invoke erb
create app/views/ collected_data
create app/views/collected_data/new.html. erb
invoke helper
create app/helpers/collected_data_helper. rb
invoke assets
invoke coffee
create app/assets/javascripts/collected_data.js. coffee
invoke scss
create app/assets/stylesheets/collected_data.css.scss
And I also ran rake routes
and got this:
collected_data_new GET /collected_data/new(.:format) collected_data#new
But whenever I load http://localhost:3000/collected_data/new
in my browser, I get:
Not Found: /collected_data/new
Here is the content of my routes.rb file:
Crows::Application.routes.draw do
get "collected_data/new"
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end