I've looked through all the related questions but nothing's new for me here.
I have a Project controller with "new" action
class ProjectsController < ApplicationController
def new
@newproject = Project.new
end
end
Project is a simple class, not active record:
class Project
attr_accessor :name, :description
def initialize
@name = ""
@description = ""
end
end
I get the error "undefined method `model_name' for Project:Class"
This is an erb file sample:
<%= form_tag(@newproject) do |f| %>
<%= f.label :name %>:
<%= f.text_field :description %><br />
<% end %>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…