Forum: Ruby on Rails Problem with migrations in Rails 2.1

Posted by Ron (Guest)
on 2008-06-03 07:55
(Received via mailing list)
Hi,

I'm trying to migrate to sqlite3 and I get this error:

syntax error, unexpected '\n', expecting tCOLON2 or '[' or '.'

I'm running OS X 10.5 on an Intel mac.  I've installed the sqlite
gem.  I'm not sure what's going on here.  Any ideas?

Thanks,

Ron
Posted by Xavier Noria (fxn)
on 2008-06-03 08:16
(Received via mailing list)
On Tue, Jun 3, 2008 at 7:54 AM, Ron <stecklyenator@gmail.com> wrote:
>
> Hi,
>
> I'm trying to migrate to sqlite3 and I get this error:
>
> syntax error, unexpected '\n', expecting tCOLON2 or '[' or '.'
>
> I'm running OS X 10.5 on an Intel mac.  I've installed the sqlite
> gem.  I'm not sure what's going on here.  Any ideas?

Is there more context? Like a file and line number where that happens?
Posted by Derek P. (Guest)
on 2008-06-03 10:09
(Received via mailing list)
Can you post the code that is throwing the problem? Hard to diagnose
this without it :)

- Derek
Posted by Ron (Guest)
on 2008-06-03 15:26
(Received via mailing list)
Hi sorry,

The code causing the problem is the auto generated migration from the
generate scaffold command in Rails 2.1.0.
Posted by Gladwright (Guest)
on 2008-07-31 09:55
(Received via mailing list)
I had the same problem.  It was a problem with scaffold-

The scaffold was creating in the migration file statements of the
form:

t.string, :title

which should be

t.string :title

The developers have probably fixed it by now.  This is just fyi for
other people encountering this problem.

Cheers
Posted by Paul A. (paul_a)
on 2011-10-12 16:24
Gladwright wrote in post #709136:
> I had the same problem.  It was a problem with scaffold-
>
> The scaffold was creating in the migration file statements of the
> form:
>
> t.string, :title
>
> which should be
>
> t.string :title
>
> The developers have probably fixed it by now.  This is just fyi for
> other people encountering this problem.
>
> Cheers

This isn't a bug--it's an operator error. If you are thinking Ruby
instead of shell, you might end up doing this at the command line:
rails generate scaffold User name:string, email:string
instead of this:
rails generate scaffold User name:string email:string

The comma gets incorporated into the migration, and the migration bombs
because of it.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.