Topic: Newbie question about rake db:seed

I am working from the book Agile web development with rails  i am at a point in the book where they ask me to copy the (seed.rb) from their website to my db folder once i have copied the file i am suppose to use the rake db:seed command to get the data to update into my program but when i run this command i get this error:


C:\ruby\Work\depot>rake db:seed
(in C:/ruby/Work/depot)
rake aborted!
unknown attribute: description
C:/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/base.rb:1564:in `block in attributes='
C:/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/base.rb:1560:in `each'
C:/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/base.rb:1560:in `attributes='
C:/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/base.rb:1412:in `initialize'
C:/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/base.rb:502:in `new'
C:/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/base.rb:502:in `create'
C:/ruby/Work/depot/db/seeds.rb:11:in `<top (required)>'
C:/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:235:in `load'
C:/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:235:in `block in load'
C:/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `block in load_dependency'
C:/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in'
C:/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
C:/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:235:in `load'
C:/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/railties/databases.rake:281:in `block (2 levels) in <top (required)>'
C:/ruby/lib/ruby/1.9.1/rake.rb:634:in `call'
C:/ruby/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
C:/ruby/lib/ruby/1.9.1/rake.rb:629:in `each'
C:/ruby/lib/ruby/1.9.1/rake.rb:629:in `execute'
C:/ruby/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain'
C:/ruby/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
C:/ruby/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
C:/ruby/lib/ruby/1.9.1/rake.rb:581:in `invoke'
C:/ruby/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'
C:/ruby/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level'
C:/ruby/lib/ruby/1.9.1/rake.rb:2019:in `each'
C:/ruby/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'
C:/ruby/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
C:/ruby/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
C:/ruby/lib/ruby/1.9.1/rake.rb:1992:in `run'
C:/ruby/bin/rake:31:in `<main>'

I am not sure what i am doing wrong, i know it has to be something simple  i am using the SQlite 3 data base.  here is a copy of the seed file data:



#---
# Excerpted from "Agile Web Development with Rails, 4rd Ed.",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material,
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
#---
# encoding: utf-8
Product.delete_all
Product.create(:title => 'Web Design for Developers',
  :description =>
    %{<p>
        <em>Web Design for Developers</em> will show you how to make your
        web-based application look professionally designed. We'll help you
        learn how to pick the right colors and fonts, avoid costly interface
        and accessibility mistakes -- your application will really come alive.
        We'll also walk you through some common Photoshop and CSS techniques
        and work through a web site redesign, taking a new design from concept
        all the way to implementation.
      </p>},
  :image_url =>   '/images/wd4d.jpg',   
  :price => 42.95)
# . . .
Product.create(:title => 'Programming Ruby 1.9',
  :description =>
    %{<p>
        Ruby is the fastest growing and most exciting dynamic language
        out there. If you need to get working programs delivered fast,
        you should add Ruby to your toolbox.
      </p>},
  :image_url => '/images/ruby.jpg',
  :price => 49.50)
# . . .

Product.create(:title => 'Rails Test Prescriptions',
  :description =>
    %{<p>
        <em>Rails Test Prescriptions</em> is a comprehensive guide to testing
        Rails applications, covering Test-Driven Development from both a
        theoretical perspective (why to test) and from a practical perspective
        (how to test effectively). It covers the core Rails testing tools and
        procedures for Rails 2 and Rails 3, and introduces popular add-ons,
        including Cucumber, Shoulda, Machinist, Mocha, and Rcov.
      </p>},
  :image_url => '/images/rtp.jpg',
  :price => 43.75)

Last edited by Theconnect (2011-08-09 05:34:21)

Re: Newbie question about rake db:seed

It's telling you the model Product does not have an attribute called 'description'.

Post your Product model.

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Newbie question about rake db:seed

i think this what you meant when you said post my product model. i got this from this file on this folder C:\ruby\Work\depot\app\models:product.rb

class Product < ActiveRecord::Base
end