Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails generate model syntax error

I'm trying to generate a model from the command line. Here is my command:

rails generate model User first_name:string last_name:string email_address:string age:integer

And it keeps giving me this error:

SyntaxError: (irb):2: syntax error, unexpected tLABEL, expecting keyword_do or '{' or '('

User first_name:str last_name:**str** email_address:str age:int

(irb):2: syntax error, unexpected tLABEL, expecting keyword_do or '{' or '('

name:str email_address:str age:**integer**

I'm lost. I learned this yesterday and the syntax is exactly the same as before when it worked fine.

Thanks

Edit: StackOverflow wouldnt let me post this unless I formatted that error as code FYI

like image 710
JDillon522 Avatar asked Dec 04 '25 03:12

JDillon522


1 Answers

You should put this command in your system console, not Rails console.

like image 105
Marek Lipka Avatar answered Dec 06 '25 16:12

Marek Lipka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!