I have a question very similar to this one but that’s a really old post on Stack Overflow so I’m coming here to see if anyone can explain this to me.
My four_for does not work when I have this
`
<%= form_for (@professor) do |f| %>
<%= f.label :fname %>
<%= f.text_field :fname %>
`
But it works fine when I have:
<%= form_for (:professor) do |f| %>
<%= f.label :fname %>
<%= f.text_field :fname %>`
By the way this is my professor controller:
class ProfessorController < ApplicationController
def show
@professor = Professor.find(params[:id])
end
def new
@professor = Professor.new
end
The answer given on Stack Overflow says that it’s because there is no route/action for the professorController, which is understandable, however before I started working on this project I read Michael Hartel’s Ruby on Rails Tutorial and he created a users model without adding a route action other than resources :user (which I have as resources :professor).
Anyone on Kirupa a Rails developer who could lend a hand?