Ruby on rails command does not trigger any action - ruby-on-rails

I'm not to ruby on rails, and I'm setting up my first application, according to a textbook (Ruby 4 in Rails). No action is triggered, When typing the command:
$ rails generate scaffold purchase name:string cost:decimal
Can anyone help me resolved this?
I installed Ruby and Rails, newest versions and then did the following steps before typing the mentioned command.
$ rails new things_i_bought
$ cd things_i_bought
$ rails server

When you do
$ rails server
You're starting the server. You don't to want do that when working from the command line.
Hit Ctrl-C to stop the server, then run your scaffold command.

Related

rails aborted when create a new folder

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

Fresh Rails 4 app is not recognizing `rails` commands, insists that I use `rails new`

I've successfully made a new application with the rails new command from a clone of the Rails master branch. The app looks fine, and is definitely Rails 4. But when I try to run any other rails command, the prompt gives me:
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
... etc etc
I've tried rails, bundle exec rails, and bin/rails, all give the same prompt. My steps for creating a new Rails 4 app were:
Clone the Rails master branch to my local machine
Create a new rvm gemset, and use it (1.9.3)
Run rails/railties/bin/rails new myapp --edge -T --skip-index-html
cd myapp and run bundle install and bundle update just to be sure
Run any rails command
What am I doing wrong? rvm-prompt suggests I am using the right gemset. One thing I did notice is that even when I remove jbuilder from my Gemfile and run a bundle update, it still appears in my gem list. Is something wrong with my rvm here?
rails-v output is 'Rails 4.0.0.beta'
See my first comment here, it contains a possible fix : https://github.com/rails/rails/issues/9715
This looks like a bug, report back to ruby on rails issues tracking: https://github.com/rails/rails/issues
I had this issue when my 'bin' folder was missing.

I can't run my Rails web server

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

RoR MySql Linux Set-Up

I'm trying to get RoR installed on my Ubuntu install and have it running with MySql. RoR and MySql have both installed fine and working but I'm having problems getting rails to work with MySql following this tutorial: http://wiki.rubyonrails.org/getting-started/installation/linux
To test your Rails installation, generate a new Rails project:
$ rails myrailsapp
If you are using MySQL, use the following command:
$ rails myrailsapp -d mysql
Now I know that you now have to type rails new [appname] not just rails [appname] to get this working once this is done and project is created its still using the sqlite3 databse so I run the next line $ rails myrailsapp -d mysql when I do this I just get a large list of text giving me various options with out changing anything.
What have I done wrong?
You actually want to generate the project with the -d specifier, not apply it to your project after generation. Start a new project like this:
rails new myrailsapp -d mysql
You need to enter just one command:
rails new railsappname -d mysql
It will create a rails app with mysql configuration.
Welcome aboard #twigg to the Rails world =).
First of all, you have to specify your Rails version you installed. If your Rails version < 3 then you can create a new project by simply running the command rails my_app_name. If you are using Rails > 3 then to create a new project just run the following command rails new my_app_name. This command will create a bunch of files one of them is the database.yml where you can configure you database parameters (adapter, username, password and database name).
If you are using Rails with MySQL, then to create a project configured with MySQL, just run the command rails my_app_name -d mysql in Rails < 3 or rails new my_app_name -d mysql
Don't forget to install the adapter of the database which is in your case (MySQL) ruby-mysql by running the command gem install ruby-mysql

ruby on rails on snow leopard

I tried the rails site_name command to create a rails application. The command says that the usage is rails new APP_PATH[options]
I tried the rails new site_name command.
I dont get any server file inside my site_name/script folder to run the application.
why is this happening?
Use
$ rails server
to start the server. In general with Rails 3, any command you would have previously run with ./script/... you now run with rails ...

Resources