i am getting "undefined method 'new' for Project:Module
My projects_controller.rb class ProjectsController < ApplicationController
def new
@project = Project.new
end
def create
@project = Project.new(project_param)
if @project.save
redirect_to project_path(@project)
else
render 'new'
end
end
private
def project_param
params.require(:projects).permit(:name, :description)
end
end
my routes
Prefix Verb URI Pattern Controller#Action root GET / pages#home about GET /about(.:format) pages#about help GET /help(.:format) pages#help projects GET /projects(.:format) projects#index POST /projects(.:format) projects#create new_project GET /projects/new(.:format) projects#new edit_project GET /projects/:id/edit(.:format) projects#edit project GET /projects/:id(.:format) projects#show PATCH /projects/:id(.:format) projects#update PUT /projects/:id(.:format) projects#update DELETE /projects/:id(.:format) projects#destroy
@project = Project.new
. Sounds like you have both a module and a class namedProject
. – Anthony