Re: rake db:migrate - error ''tSYMBEG''

Josh P.
Fri, 16 Feb 2007 18:34:04 -0000

Phlip wrote:
> Josh Josh wrote:
>
>> rake aborted!
>> ./db/migrate//003_add_test_data.rb:5: parse error, unexpected tSYMBEG
>>    5.        :description =>
>>
>> (and the ''d'' in description has a little arrow below
it pointing up)
>
> Welcome to how Ruby displays syntax errors. The language is so
> flexible that it provides confusing diagnostics. This is why I compile
> and test after only a few edits.
>
> Post your whole file. Something on the line before this one left the
> parser not expecting a symbol.
>
> --
>   Phlip
>   http://c2.com/cgi/wiki?ZeekLand  <-- NOT a blog!!


Ok, here''s the whole file:

[code]
class AddTestData < ActiveRecord::Migration
   2.   def self.up
   3.     products = []
   4.     products << {:title => ''Pragmatic Project
Automation'',
   5.       :description =>
6. %{
7. Pragmatic Project Automation shows you how to
improve the
   8.        consistency and repeatability of your project''s procedures
using
   9.        automation to reduce risk and errors.
10.
11.
  12.         Simply put, we''re going to put this thing called a
computer to work
  13.         for you doing the mundane (but important) project stuff.
That means
  14.         you''ll have more time and energy to do the really
  15.         exciting---and difficult---stuff, like writing quality
code.
16. },
  17.       :image_url =>   ''/images/auto.jpg'',
  18.       :price => 29.95 }
  19.
  20.     products << {:title => ''Pragmatic Version
Control'',
  21.       :description =>
22. %{
  23.          This book is a recipe-based approach to using Subversion
that will
  24.          get you up and running quickly---and correctly. All
projects need
  25.          version control: it''s a foundational piece of any
project''s
  26.          infrastructure. Yet half of all project teams in the U.S.
don''t use
  27.          any version control at all. Many others don''t use it
well, and end
  28.          up experiencing time-consuming problems.
29. },
  30.       :image_url => ''/images/svn.jpg'',
  31.       :price => 28.50}
  32.
  33.     products << {:title => ''Pragmatic Unit Testing
(C#)'',
  34.       :description =>
35. %{
  36.         Pragmatic programmers use feedback to drive their
development and
  37.         personal processes. The most valuable feedback you can get
while
  38.         coding comes from unit testing.
39.
40.
  41.         Without good tests in place, coding can become a
frustrating game of
  42.         "whack-a-mole." That''s the carnival game where
the player
strikes at a
  43.         mechanical mole; it retreats and another mole pops up on
the opposite side
  44.         of the field. The moles pop up and down so fast that you
end up flailing
  45.         your mallet helplessly as the moles continue to pop up
where you least
  46.         expect them.
47. },
  48.       :image_url => ''/images/utc.jpg'',
  49.       :price => 27.75}
  50.     products.each do |p|
  51.       product = Product.create(p)
  52.       raise product.errors.inspect unless product.valid?
  53.     end
  54.   end
  55.
  56.   def self.down
  57.     Product.delete_all
  58.   end
  59. end