Can't get form to render

Hi All,

I cant for the life of me work out why the form isn’t rendering…
I have attached an image of the file without the rendered form.

I’ve attached all the code from the controller, route, and views html
file thingy, and the master html file thingy as well…
You can probably tell I am a complete beginner. I have rails 3 I think
and have managed to get other pages from this application working such
as index showing all rows on the database and also a page with
individual rows from the database

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

Ads: <%= controller.action_name %> <%= stylesheet_link_tag 'default.css' %>
    <h1>MeBay</h1>
    <ul id="nav">
      <li><a href="/ads/">All Ads</a></li>
    </ul>
  </div>
</div>

<div id="content">
  <%= yield %>
</div>
<div id="clearfooter"></div>
</div>

New ad

<% form_for(@ad,:url=>{:action=>'create'}) do |f| %>

Name
<%= f.text_field :name %>

Description
<%= f.text_area :description %>

Price
<%= f.text_field :price %>

Seller
<%= f.text_field :seller_id %>

Email
<%= f.text_field :email %>

Img url
<%= f.text_field :img_url %>

<%= f.submit "Create" %>

<% end %>

On 10 November 2011 21:42, Dan S. [email protected] wrote:

Hi All,

I cant for the life of me work out why the form isn’t rendering…

<% form_for(@ad,:url=>{:action=>‘create’}) do |f| %>

Try
<%= form_for… %>

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs