My client wants me to download a working ruby on rails project to my local system. But when I connected to a server, I got nine identical project folders (which seem like different versions). Is there a way to know which project is running using process id (I have only the process id)?
If you have the process ID, then check /proc/[pid]/cwd symbolic link. This is the process' current directory.
I assume that you are on a Linux-like system.
If you are not, then you may issue a HTTP request (to wake up the rails app) and then look which logfile has been modified recently.
if you are able to run rails console on your server then type this: Rails.root in your console or irb it will tell that project you are on belongs to which directory!
no we cant know using process id. but when you start server you will find rails version like
:> ruby script/server
=> Booting Mongrel
=> Rails 2.3.10 application starting on http://0.0.0.0:3000
above line using rails 2.3.10 version and if you want to know ruby version simply call
ruby -v in your command prompt
Related
I've transferred an older RoR app onto a new workstation and now having issues starting it.
For instance when I attempt to use the "rails server" command it generates a new rails application rather than starting the server.
I did have it running last night but after attempting to use the 'Production' database, apparently the 'rails server -e "production" ' command is obsolete. I therefore tried:
RAILS_ENV=production
And it seems the application was not longer working.
There was also lots of documentation and suggestions to use RVM....which I installed....could that be the cause the 'rails server' command is not starting the server but rather creating a new app?
You should do
RAILS_ENV=production rails s
on rails app dir.
I think your app is on rails 3, with rails 4 installed.
To start the server I had to use: bundle exec rails server what's going on? – paulywill yesterday
Using bundle exec will ensure it uses the version of rails from your Gemfile. This is default behaviour after Rails 3.1 but your app is older than that. – Graeme McLean yesterday
total n00b question here but I can't seem to find the answer searching around here or the web.
I have Ruby v1.8.7 (2009-06-12 patchlevel 174) and Rails v.2.3.5 installed on my Mac (10.6.8). I have no problem generating a Rails directory and starting the Ruby server, but what happens is that once the server is started I have no prompt and no code I type seems to execute.
to be specific - here is the terminal code from a session:
bvb:new bennettvonbennett$ ruby script/server
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
after this point there is no prompt and no command I type seems to produce a result.
what am I doing wrong?
This is the correct behavior. You're not doing anything wrong.
The server runs in the foreground so that you can see the log output on every page load without having to open a specific log file. It's very helpful for debugging and staying aware of what the code you write does to the application and the database.
To return to a normal command prompt, you can send an end-of-text character (usually ctrl-c) to stop the server. Most of us Rails-folk work with multiple terminal windows open - server running in one, and others for other functions, such as the rails console, started with
ruby script/console
which will let you experiment with other Rails controller functions, much like irb for standard Ruby.
With ruby script/server you launch the webserver. Run ruby script/console if you want to execute commands against your current Rails application.
You're loooking for:
script/console
If you want to play with your project in a console.
I couldn't find anyone else with this problem so I thought I'd ask.
rails new myNewRailsApp
This works fine.
cd myNewRailsApp
ls
Reveals everything seems to have generated properly.
rails server
This creates a new directory "server" and creates a new rails application. It also seems to happen with "generate" and other command words. I'm on version 3.0.9 (considering rolling back now), and I purged it, all gems, and reinstalled. Am I missing something obvious?
Edit: I'm running on Ubuntu 11.04.
Looks as though it's using Rails 2 to generate a new app within your app. I've done this a few times and the amount of apps I've created with app names of "c" and "s".
To get round either use
bundle exec rails server
or
script/rails server
Or uninstall rails 2 from your system
Seems like the command is still using 2.x version of rails.
If you want to use multiple versions of rails for different projects use rvm to create gemset for each rails version.
[http://beginrescueend.com/][1]
If you dont want to use rvm, uninstall older versions of rails and try re-installing rails 3.x.
I have just started to learn Ruby on Rails and in going through a tutorial I am not able to launch the rails project because of the following error.
-e:4:in `load': no such file to load -- script/server (LoadError)
from -e:4:in `<main>'
I have installed Ruby 1.9.2 and using RadRails as the IDE for creating and executing the Rails project. Any suggestions?
Most likely your tutorial refers to Rails 2 (for which given command works), while you're using Rails 3.
I'm not sure how exactly you start server in Rails 3 (edit see answer by jdl), but take my adice: find another tutorial. Otherwise, you'll have to create such questions here several times a day :)
If you just installed the latest Rails the the command has changed (as of Rails 3) to:
$ ./script/rails server
I think the best way to start a server in Rails 3 is to run this command from the root of the project:
rails server
You should have the rails executable in your path if you've installed the Rails 3 gem.
says if i develop a Ruby on Rails application using Rails 2.3.2, will that usually be compatible with Passenger on my hosting company?
If i ssh to my hosting company and type rails -v, i get 2.2.2... so looks like they might be using Rails 2.2.2.
So if i develop a Rails app on my Macbook and ftp all files over there, will the Passenger there usually work well with the generated code with the current version of Rails?
Freeze rails into vendor/rails using the built in rake task. That way your app will ue the version of rails you want it to no matter where you deploy it.
rake rails:freeze:gems
And the easiest way to do a specific version I know of.
rake rails:freeze:edge RELEASE=2.3.2.1
Now your version of rails will go with you where you send your app.
You can unpack other gem dependencies into vendor/gems for any gem you are using and want to be sure that it is available where ever you deploy the application.
rake gems:unpack
And to ensure their dependencies go to:
rake gems:unpack:dependencies
I would also suggest that you verify that they are running the latest version of passenger.
I would verify the version of Passenger they have installed (or confirm they have it installed at all). I would also suggest you freeze your version of Rails.
Just second something for railsninja's answer .
First say, it won't work straightaway.
Is that host a vps to you or have sudo access somehow?
If yes, I suggest you to do rake gems:install instead of gems:unpack, because some of gems are os dependent e.g (Rcov, RedCloth...etc.)
I will ask the hosting company of their passenger's configuration, the important question will be if they use RailsSpawnMethod: smart or smart-lv2(default).If they use the smart method, then it is a better idea to freeze your gems and rails otherwise will have the compatible issue as you can find reference from passenger user manual about the RailsSpawnMethod.
It will be nearly 100% compatible if you freeze your gems(all the gems need to be declared correctly in the environment.rb with config.gem, e.g(config.gem 'will_paginate',:source=>"http://gems.github.com")) and RAILS!!!!!