0

I had installed Rails in Ubuntu 10.04. And had some applications up and running. But after updating the Ubuntu to 14.04, rails apps are not working.

When I try to start my Rails app (As $rails server), am getting the following warning and help:

bin/rails:6: warning: already initialized constant APP_PATH
/home/razor/rails_projs/simple_cms/bin/rails:6: warning: previous definition of APP_PATH was here
Usage: rails COMMAND [ARGS]

The most common rails commands are:
 generate    Generate new code (short-cut alias: "g")
 console     Start the Rails console (short-cut alias: "c")
 server      Start the Rails server (short-cut alias: "s")
 dbconsole   Start a console for the database specified in config/database.yml
         (short-cut alias: "db")
 new         Create a new Rails application. "rails new my_app" creates a
         new application called MyApp in "./my_app"

In addition to those, there are:
 application  Generate the Rails application code
 destroy      Undo code generated with "generate" (short-cut alias: "d")
 plugin new   Generates skeleton for developing a Rails plugin
 runner       Run a piece of code in the application environment (short-cut alias: "r")

All commands can be run with -h (or --help) for more information.
rAzOr
  • 300
  • 6
  • 19
  • While updating ubuntu to 14.04, it asked if I want to remove some obsolete packages. And chose Yes, does that matter? – rAzOr Sep 20 '14 at 15:38

2 Answers2

0

That happened to me when I mistakenly tried to run rails server from outside of the app directory and again from inside a gem/engine directory. Can you confirm that you are inside your main app? It looks like you are, if your app name is simple_cms.

If so, then what do you get when you run

type rails

and

which rails

Its weird that it gives you the option to create an app from within an app, that isn't possible. Which version of rails do you have installed?

CleoR
  • 806
  • 6
  • 18
  • yeah, am running rails server from inside my app. And output of the commands are as follows: $type rails `rails is hashed (/home/razor/.rvm/gems/ruby-2.1.2/bin/rails)` $which rails `/home/razor/.rvm/gems/ruby-2.1.2/bin/rails` – rAzOr Sep 20 '14 at 17:41
  • Can you give me the rails version too? I think the command is rails -v and also the version of rails your app is using. Could you also try and create a new rails app and run rails server from within that. – CleoR Sep 21 '14 at 01:43
  • Rails version : `4.1.6` Tried with new app, even that is giving the same result. – rAzOr Sep 21 '14 at 04:16
0

This link, helped me with the problem. I had to uninstall mysql2 gem and then reinstall it.

Commands I used

$gem uninstall mysql2
$gem install mysql2

Than everything was fine, could start server.

rAzOr
  • 300
  • 6
  • 19