Я не могу на всю жизнь понять, почему форма не отображается ...
Вы, вероятно, можете сказать, что я полный новичок.У меня есть rails 3, я думаю, и мне удалось заставить другие страницы этого приложения работать, такие как индекс, показывающий все строки в базе данных, а также страницу с отдельными строками из базы данных.
Вот мой контроллер
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
маршруты:
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
и представление:
<% 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 %>
А вот что отображается:
![rendered view with form missing](https://i.stack.imgur.com/4nBfD.jpg)