dugq
dugq

Reputation: 63

can Rails model names include numbers?

I have a ~ 6000 record set of data where each record has a date field, and I'd like to segregate it by year in order to make it more manageable. I successfully generated a scaffold, then ran a migration, and put the records for the current year into the database. I then destroyed the scaffold in order to generate separate ones for each year. I tried naming the first one "2012Violation" (the scaffold that I successfully created and then destroyed was called simply "Violation")), but I'm getting the NameError "wrong constant name 2012Violation." I suspect that maybe rails doesn't allow numbers in model names. If that is indeed what is causing this error, any suggestions for how to name a bunch of different scaffolds/models that will primarily differ based on what year the record is from?

Thanks!

Upvotes: 2

Views: 1634

Answers (1)

bevanb
bevanb

Reputation: 8521

You can use numbers, but the first character cannot be a number.

Upvotes: 8

Related Questions