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



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Ads: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'default.css' %>
</head>
<body>
<div id="wrapper">
<div id="header">
<div>

<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>
<div id="footer"></div>
</body>
</html>



<h1>New ad</h1>
<% 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 %>

Attachments:
http://www.ruby-forum.com/attachment/6737/No_Forms_Showing.jpg


--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Colin Law at Nov 10, 2011 at 9:57 pm

    On 10 November 2011 21:42, Dan S. 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

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedNov 10, '11 at 9:43p
activeNov 10, '11 at 9:57p
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Dan S.: 1 post Colin Law: 1 post

People

Translate

site design / logo © 2021 Grokbase