I am using rails 3 and the steps that I have done

1.rails new MeBay

2.rails g model ad name:string description:text price:decimal 
seller_id:integer email:string imr_url:string

3.rake db:migrate

4.rails generate controller ads

5.show.html.erb

 
<html>
    <head>
      <title> </title> 
    </head>
    <body>
    <p>
      <b>Name:</b><%= @ad.name %>
    </p>
    <p>
     <b>Description:</b><%= @ad.description %>
    </p>
    <p>
     <b>Price:</b><%= @ad.price %>
    </p>
    <p>
     <b>Seller Id:</b><%= @ad.seller_id %>
    </p>
    <p>
     <b>Email:</b><%= @ad.email %>
    </p>
    <p>
     <img src="<%= @ad.img_url %>"/>
    </p>
    </body>
    </html>


6.config/routes.rb

controller 'ads' do
               match 'ads/:id' => :show
 match 'ads/:id' => :index
       end


7.ads_controller
def show
  @ad = Ad.find(params[:id])
end
def index
  @ads = Ad.find(:all)
end




8. index.html.erb
<h1>All ads</h1>
<ul>
  <% for ad in @ads %>
  <li><a href ="/ads/<%= ad.id %>"><%= ad.name %></a></li>
  <% end %>
</ul>


after starting the rails server 

in browser I am trying

http://localhost:3000/MeBay
http://localhost:3000/show/ads/3

I am getting routing error. Please help on solving this error.

No route matches [GET] "/MeBay"
No route matches [GET] "/show/ads/3"

please note:other scaffolding project that I created in RoR runs well. but 
not this one. please help where I went wrong.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/3d24aeb4-c5d2-4ed0-a79d-b8aa079b01c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to