나는 내 인생을 위해 캔트가 왜 모양이 렌더링되지 않는지 알아 낸다 ...레일 3에서 렌더링 할 폼을 가져올 수 없습니까? 도움?
아마 내가 완전한 초보자라는 것을 말할 수있다. 나는 레일이 있다고 생각한다. 이 애플리케이션에서 다른 페이지를 가져와 처럼 데이터베이스의 모든 행과 데이터베이스의 개별 행을 표시하는 페이지로 표시한다.
Mebay::Application.routes.draw do
match '/ads/new' => 'ads#new'
match '/ads/create' => 'ads#create'
match '/ads/:id' => 'ads#show'
match '/ads' => 'ads#index'
resources :ads
end
및보기 :
여기
class AdsController < ApplicationController
def new
@ad = Ad.new
end
def show
@ad = Ad.find(params[:id])
end
def index
@ads = Ad.find(:all)
end
end
경로 내 컨트롤러의
<% form_for(@ad,:url=>{:action=>'create'}) do |f| %>
<p><b>Name</b><br /><%= f.text_field :name %></p>
<p><b>Description</b><br /><%= f.text_area :description %></p>
<p><b>Price</b><br /><%= f.text_field :price %></p>
<p><b>Seller</b><br /><%= f.text_field :seller_id %></p>
<p><b>Email</b><br /><%= f.text_field :email %></p>
<p><b>Img url</b><br /><%= f.text_field :img_url %></p>
<p><%= f.submit "Create" %></p>
<% end %>
을 그리고 여기에 렌더링 작업은 다음과 같습니다
에 오신 것을 환영합니다. 나는 당신의 포맷팅을 조금 돋보이게했다 .-D –