Cannot start project in rails - ruby-on-rails

I'm pretty new to Rails.
I created a new Rails app: rails new app_name, and ran rails server etc.
But, once I shut down and reopened my machine, I can run neither rails server nor rails console. It says to use the rails new app_name command again, but I just want to restart where I left off the day before.
Any advice is very much appreciated.

I'm guessing your current working directory of your command line is not in your project directory which you created yesterday.
cd some_path/to_my/rails_project
rails server
You must be in the directory that represents your project to do things like launch the server. Otherwise, how does it know what project to launch a server for?

Just make sure you are in the directory of the rails app you created. Sounds like you aren't.

Related

why rails server is not working on windows 10

I have created the new rails project and trying to run it without doing any changes. I am using the power shell in windows 10. When I am running the rails s command its not starting the server. Please see attached image. I have highlighted the installed ruby version.
The error is there in the output, you do not have a rails app to start a server for, you can create a new app with:
rails new <name-for-your-app>
Follow along this tutorial
to help you get started with rails.
I think this command will work or you are missing something which is required to run rails server
bin/rails server
I've got similar error when I am not in rails project directory. Seems you are out of directory.
Please run those full commands in powershell
cd c:/
rails new testapp
cd testapp
rails s

Rails server not working when copying back from staging deploy

I ssh copied a rails app from a staging server because the development repository has been lost. My goal is to create a new development code base using the deployed code as a source. So far I have removed a hidden .bundle folder and replaces several aliases with folders and files. I then ran bundle install. For the database I did a sql dump from staging and used it to build a development database. I think I'm ready to run rails server. But when I try to run rails server in the base directory. It gives me the rails command line help as if I was running rails s in a directory with no app.
I'm not even sure if it is possible to reverse a deploy this way. I've looked at the rails guide on the app initialization process and all the files seem to be in place.
Remember that for Rails to start up, you need bin/rails, bin/bundle, config/boot, etc.
If you restore those files, it should work again.

Error: Rails command not found

I created a new Rails project in a directory, say Desktop (rails new project1). After that, I ran the following command:
rails server
Then, the project1 was running on localhost.
After that, I made another directory with name (project1) in another location. I copied all the files from the previous location to new location. After that, when I ran the following command:
rails server
I got the following error message:
Rails is not currently installed on this system.
But it is working in the previous directory. How do I solve this?
If you are totally new to Rails development and System administration it is rather complicated in the beginning. I recommend any kind of Rails tutorial to you for examply by Michael Hartl .
As Graeme McLean points out you somewhen understand that there is information about your environment needed to help you.
Most likely the requirements you need to be set up are not set up in the place you did copy your rails project as Pavan and Thaha kp pointed out.

Rails How To Upload Code To The Production Server

I managed to create my first ROR application, called myapp, locally and I also have created another ROR application on my webfaction server with the same name myapp. My question is every time I run commands "rails generate model" or "rails generate controller", how can I synchronise my local environment with my webfaction server. There seem to be lots of files generated when you run rails commands. Does it mean I have to upload the whole application directory every time I generate something? Kindly suggest with your experience, I'm very new to Rails.
If I were you I would go for Heroku first. It's free and easy and along the way you will learn some about hosting Rails apps.
Getting started with Heroku is a good place to go first https://devcenter.heroku.com/articles/quickstart
Heroku is indeed the easy way out, if you are looking into more "metal" deployment - use Capistrano

cannot run rails server command for already created project

I have got an application which was zipped and I unzipped the files and it gave me a folder with all the required structure of a rails application. But when I am going inside the directory and running the rails server command, its not doing anything, but showing me the list of options rails command can do. What would have been the problem?
thanks
Maybe this will help from app folder try:
ruby script/rails server
As explained by Dave Isaacs, Showing the list of options is what the rails command does when it is executed outside the context of an application (i.e., not in the application directories).
Type the full command, including the /script path to the CLI.
script/rails server
instead of
rails server
where script is the path to the rails command that, in a Rails 3 application, lives in the script folder.
I would assume that the application you got was written with rails 2.x. In that case, you have to start it with
script/server

Resources