이 오류의 출처를 찾기 위해 약간의 문제가 있습니다.noMethodError in Property # new
나는이 오류가 무엇입니까 : 나는 확실하지 않다
를, 그것은 문제가 뷰에서 내 폴더의 이름과 관련이있다, 내가 (대신 속성의 ... 그것을 속성을 이름 나는 이미 그것을 변화 시도하지만, 난 여전히
이 내 모델
모습입니다) 오류가 발생class Property < ApplicationRecord
validates :address, presence: true, length: {minimum: 10}
validates :price, presence: true
validates :description, presence: true
validates :bedrooms, presence: true
validates :bathrooms, presence: true
validates :type, presence: true
validates :sqft, presence: true
validates :lot, presence: true
validates :year_built, presence: true
end
이 내 컨트롤러 :
property_controller.rb
class PropertyController < ApplicationController
def index
@properties = Property.all
end
def new
@property = Property.new
end
def create
@property = Property.new(property_params)
if @property.save?
flash[:notice] = 'Property was successufully created.'
redirect_to property_path(@property)
else
render :new
end
end
private
def property_params
params.require(:property).permit(:address, :price, :description,
:bedrooms, :bathrooms, :type, :sqft, :lot, :year_built)
end
end
내보기 파일
내가 코멘트 경우 때문에 오류가, 형태와 것 같다_form.html.erb
<% if @property.errors.any? %>
<h3>The following errors prevented the addition of this property.
</h3>
<ul>
<% @property.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
<% end %>
<%= form_for @property do |f| %>
<div class="form-group">
<%= f.text_field :address, required: true, placeholder: "Address",
class: "form-control"%>
</div>
<div class="form-group">
<%= f.text_field :price, required: true, placeholder: "Price",
class: "form-control"%>
</div>
<div class="form-group">
<%= f.text_area :description, required: true, placeholder:
"Description", class: "form-control"%>
</div>
<div class="form-group">
<%= f.button :submit, class: "btn btn-success" %>
</div>
<% end %>
new.html.erb
<h3>Add new Property:</h3>
<%#= render 'form' %>
new.html.erb가 잘 표시됩니다. 어떤 도움을 주시면 감사하겠습니다.
레이크 경로 | 그렙 특성
레이크 루트 | grep 속성'? – rony36
확실한 점은 위 이미지를 추가 한 이유는 답변이 너무 길기 때문입니다. 사용자 자원 : 루트를 환영 자원 '# 인덱스를 환영합니다'특성을 끝 – Lucky500