Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9131245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:06:43+00:00 2026-06-17T08:06:43+00:00

I am following Head First Rails which has been written for older version of

  • 0

I am following Head First Rails which has been written for older version of rails. I am working on its chapter 2 project but in Rails 3. Following are my files.

ads_controller.rb

class AdsController < ApplicationController
  def show
    @ad = Ad.find(params[:id])
  end

  def index
    @ads = Ad.find(:all)
  end
end

ad.rb

class Ad < ActiveRecord::Base
  attr_accessible :description, :email, :img_url, :name, :price, :seller_id
end

index.html.rb

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

show.html.rb

<body>
    <p>
        <b>Name:</b><%= @ad.name %>
    </p>
    <p>
        <b>Description:</b><%= @ad.desciption %>
    </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>

schema.rb

ActiveRecord::Schema.define(:version => 20121209174120) do

  create_table "ads", :force => true do |t|
    t.string   "name"
    t.text     "description"
    t.decimal  "price"
    t.integer  "seller_id"
    t.string   "email"
    t.string   "img_url"
    t.datetime "created_at",  :null => false
    t.datetime "updated_at",  :null => false
  end

end

Database is populated for all the fields. http://0.0.0.0:3000/ads/ works but http://0.0.0.0:3000/ads/<any number> does not work and throws the following error:

NoMethodError in Ads#show

Showing /Users/ava/Projects/mebay/app/views/ads/show.html.erb where line #6 raised:

undefined method `desciption' for #<Ad:0x007f7ff346c100>

Extracted source (around line #6):

3:      <b>Name:</b><%= @ad.name %>
4:  </p>
5:  <p>
6:      <b>Description:</b><%= @ad.desciption %>
7:  </p>
8:  <p>
9:      <b>Price:</b><%= @ad.price %>

Rails.root: /Users/ava/Projects/mebay
Application Trace | Framework Trace | Full Trace

app/views/ads/show.html.erb:6:in `_app_views_ads_show_html_erb___4217851794431988162_70093760484140'

On server window:

ActionView::Template::Error (undefined method `desciption' for #<Ad:0x007f7ff346c100>):
    3:      <b>Name:</b><%= @ad.name %>
    4:  </p>
    5:  <p>
    6:      <b>Description:</b><%= @ad.desciption %>
    7:  </p>
    8:  <p>
    9:      <b>Price:</b><%= @ad.price %>
  app/views/ads/show.html.erb:6:in `_app_views_ads_show_html_erb___4217851794431988162_70093760484140'

If I remove description in show.html.rb then it works fine and displays name, price, seller_id and email. What am I doing wrong?

Ruby version: ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.4.0]
Rails version: Rails 3.2.7

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:06:44+00:00Added an answer on June 17, 2026 at 8:06 am

    You’re missing the ‘r’ in ‘description’ in show.html.erb:

    undefined method 'desciption'

    <b>Description:</b><%= @ad.desciption %>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working through the Head First C# book and have used the
I am working through head first jquery and I am on a chapter dealing
I'm following Head First Java. I created a simple servlet as they instructed but
I've been converting a project to use the asset pipeline, but am hitting a
I have done very little in C# and am following the Head First C#
In Head First Ajax, they give the following example: function getDetails(itemName) { request =
The following code is presented, in the book Head First jQuery . function lightning_one(t)
I tried to run the code from Head First Java as the following: public
I’m new to Python and I’m currently following the Head First Python book. I’m
There's a lot of confusion over MVC but after flicking through a Head First

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.