I have rails 5 installed via rvm, and when I type rails -h or rails generate model -h etc, I only get the standard help message :
$ rails generate model -h
Usage:
rails new APP_PATH [options] ...
I should be able to get help with all of the different rails commands on the console. Any suggestions?
Thanks.
Doh! I was in the wrong directory and/or I hadn't generated a new project yet.
It's working fine now, thanks.
Related
I am meeting a rails problem.
I created a rails folder by this command
rails new airbnb-clone -T -d postgresql --css tailwindcss
And it gave me these problems
1st
rails turbo:install stimulus:install
rails aborted!
Second
rails css:install:tailwindcss
rails aborted!
I thought that when I used the code tailwindcss, it must automatically create the tailwindcss by rails ? So why it had these error ? Should I must install tailwindcss by hand ? Could you please give me some advices?
By the way, here is my rails and ruby v
rails -v 7.0.4
ruby -v 3.1.2
Just change the argument to tailwind instead of tailwindcss:
rails new airbnb-clone -T -d postgresql --css tailwind
I use this command, you can try. I think that's oki.
rails new airbnb-clone -T -d postgresql -c=tailwind
I am newbie with Rails and trying to make a new static web pages by this command in cmd
rails generate controller pages about location
before ran this command, I am sure that I set up rails ok. But I got those error
Here is some more information about my rails, when I ran
rails -v : Rails 6.0.3.2
I am very confusing because of this problem, could you please give me some ideas? Thank you very much.
I've followed this article to do this, but after I excuted rails server, he just gave me the output of rails -h, I have no idea about it, somebody help me out!!
Did you created any project yet? you have installed rails correctly. Now you have to create project. If you have created your project than do cd myapp and now run following command
rails s
It should work, I hope you already installed postgres as per tutorial, but if not no worry, following will still work using sqlite3
rails new newmyapp
It will show you screenflow activities. Now it finish just change directory to myapp using cd newmyapp and run following command
rails s
it will show your famous rails page.
I would like to create a new model for a Ruby on Rails application. I know that this should do:
$ ruby script/generate model Book
But it gives me:
ruby: No such file or directory -- script/generate (LoadError)
Why is that? How can I fix that? I am in my application folder.
What version of rails are you running? As far as I know it should be script/rails - but I am running rails 3.1.3
Edit: as #Jeremy bellow stated, in rails 3 and up it is script/rails - or of course, more generally, just rails
Run
ruby script/rails -h
and you should see the available commands
Run
ruby script/rails generate -h
to see what is available to generate
Alternatively, you should also just be able to run:
rails generate -h
I have never found the ruby script/rails portion to be necessary, it defaults to that automatically
If you're using Rails 3, you do it like this:
$ rails generate model Book
The way you tried is the old way. Maybe you're following an old tutorial or something.
I have installed ruby193 and I've installed rails via the command prompt. However, whenever I try the command:
ruby script/server
I get this error:
ruby: No such file or directory -- script/server (LoadError)
I checked my script folder and all it has is a file called rails.
I'm very new to Ruby on Rails and I'm not entirely sure if I've installed everything correctly. Is there an easy way to check what I have installed?
To clarify on the existing answers, ruby script/server is no longer the proper way to start a server in Rails. In Rails 3, we use rails server, which can be shortened to rails s. See the Rails Guides for a more extensive rundown of the Rails 3 command line interface.
Try running rails server or rails s.
If you have Ruby & rails installed properly, then ruby -v would result in the version that you have installed and likewise rails -v would give the rails version installed.
To run a rails server try running rails server or rails s