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
Name:<%= @ad.name %>
Description:<%= @ad.description %>
Price:<%= @ad.price %>
Seller Id:<%= @ad.seller_id %>
Email:<%= @ad.email %>
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
- index.html.erb
All ads
-
<% for ad in @ads %>
- <%= ad.name %> <% end %>
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.