Carine Todmia
Carine Todmia

Reputation: 11

ruby on rails will not generate model

I am trying to generate a model in rails. I write:

rails generate model Post content:text

And it won't do anything. I don't even get an error message. Only the warning about using fiddle but I don't think that should stop me. I am using windows and Ruby version 2.0 . I know it's suppose to say create etc but it literally says nothing. Please help. I can't even move on

Upvotes: 1

Views: 1023

Answers (4)

Carine Todmia
Carine Todmia

Reputation: 11

So that works when i create my app using

rails new myapp

however when i went to a meetup and they were helping me get started they told my to start an new application using

rails new myapp -O - T

the addition of the -O -T was probably what was holding me back from creating the model because once i removed it i was able to generate a model. Does anyone have any idea what that -O -T stands for and its implication when creating an app? but anyway besides that my model is now working:)

Upvotes: 0

Nihal Nizar
Nihal Nizar

Reputation: 165

First run

spring stop

Now, try to generate model

Upvotes: 3

aaron-coding
aaron-coding

Reputation: 2621

Have you tried generating your rails app first?

rails new myApp
cd myApp/
rails generate model Post content:text

This will now generate the desired code. You must be inside a rails directory to run the appropriate commands.

If you "rails new myApp" command does not generate output and a folder, then you do not have rails installed.

Upvotes: 0

Ezio Auditore
Ezio Auditore

Reputation: 169

Ruby use rails to create some steps.

For creating is:

rails g model post

Or try:

rails generate model post

However check if you installed ruby correctly use this is your command prompt:

ruby - v     

And then check if rails was installed in your command prompt:

rails -v

Upvotes: 0

Related Questions