Running Rails server on ubuntu - ruby-on-rails-3

I'm trying to get rails running on Ubuntu (11.04). I've installed my gems and whatnot -- I can see all of them thru 'gem list'. However, when I run the command rails s or rails server, rails for some reason tries to create a new app called 's' or 'server' (respectively) instead of running the server. Any advice?

check the output of rails -v, it'll probably report rails 2.3.x - that will be your problem.

Related

Error using rake for rails 1.2.3 on rails 3.2

I am trying to install a rails 1.2.3 app on my machine. My machine is currently using rails 3.2.6 , ruby 1.9.3 and windows 7. While trying to use 'RAKE', I am getting the following error
WARNING: 'require 'rake/rdoctask'' is deprecated.
Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
How shall I figure out the problem in order to be able to use my application.
In your Rakefile you should change the require statements as rake demands it. There might be follow up errors so it would be best to update Rake to match your rails version.

Difficulty with activesupport when attempting to deploy

I have a rails application that I am trying to deploy onto the internet. I have setup a server on the Amazon EC2 cloud, that I know works because I have deployed another site to the same machine.
When I try to run this new application either through 'rails console' or when running 'rake db:seed' or just by trying to browse to the application, rails crashes saying it cannot find activiesupport:
/home/ec2-user/.gem/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/core_ext/big_decimal/conversions.rb:1:in `require': cannot load such file -- bigdecimal (LoadError)
My Rails version is 3.2.2 and I'm using ruby 1.9.3p0 (2011-10-30) [x86_64-linux]. My database is MongoDB which I access through Mongoid. And I'm using Passenger and Apache as a server.
Is there any configuration step or something like that that I have missed?
P.S. I know I shouldn't be using ec2-user, I'm still experimenting. And also, I've never had much luck with RVM.
I encountered the same problem with Rails 3.2.3 and Ruby 1.9.3p0 on my Amazon EC2 instance, where Ruby had been installed with the ruby19 yum package. In my case, the problem seemed to be that I had installed the bigdecimal gem manually using the gem command instead of using Bundler. To fix the problem, I uninstalled the gem manually, added the line
gem 'bigdecimal'
to my application's Gemfile, and re-ran bundle install. This reinstalled the gem and then my application was able to load it successfully.
My gems are also installed in ~/.gem/ruby/1.9.1/, even though I am running Ruby 1.9.3p0. This does not appear to be a problem.

rails command doesn't work

I've tried to start the rails server with this line:
$ rails s
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
...
create log/test.log
But if I write down this:
$ script/rails s
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:138: warning: Insecure world writable dir /usr/lib/ruby/gems/1.8 in PATH, mode 040777
=> Booting WEBrick
=> Rails 3.0.1 application starting in development on http://0.0.0.0:3000
...
Anyone can see the problem? I think is a problem with environment variables, but I don't know how to fix it.
Thanks
I just came across this problem. I was switching from a Windows environment to Linux. My Linux version of rails is 2.3.14 while my Windows version was 3.0.1. On Windows "rails s" or "rails server" worked as expected to start a server, but on Linux it just created new projects with the names "s" and "Server" respectively. What finally explained it is the answer to the question below. Apparently the command behavior was changed between rails versions.
rails script/server doesn't start the server
The best solution is probably to update to the latest rails.
I was able to do that on my linux box by following the instructions below and using "sudo gem install rails"
http://installfest.railsbridge.org/installfest/ubuntu
http://root2linux.com/2011/01/install-rails-3-on-linux-mint-10/
this issue come from the different version in rvm, I faced this issue when my app was created using rvm 1.9.2 and I tried to run the server while rvm 1.9.3 was the running rvm version, simply switch to rvm1.9.2 and all will work properly (rvm use 1.9.2) in the terminal in ubunutu
Are you in a rails application directory? When you're running rails s make sure you've cd'd into the correct Rails directory. Common problem :)

rails c to launch console stopped working in Rails 3 on Linux?

I'm not sure what I did, but now 'rails c' to launch console doesn't work....what can I do to restore that?
What it does is it creates a rails app in directory "c"... :(
I use
script/console. for rails2
script/rails console for rails3
I also set up an aliases fit them as ssc and src...
You have Rails 2.3 installed, and the old rails command overrides the command from Rails 3.
bundle exec rails c should work.
To uninstall Rails 2.3, run
gem uninstall rails --version '<3'
(if that's what you want, of course)

netbeans 6.9 rake error on Ubuntu 11.04

Each time I try to run a brand new rails project in Netbeans I get the following error:
"Could not find rake-0.9.2 in any of the sources (Bundler::GemNotFound)"
What's happening?
P.S: I already did a bundle install and if I run "ruby s" from the console it works.
Thx.
Try to do the same manually, i.e from the terminal. First check which version of rails you are running, then try to bundle again from the terminal.
I suppose that your environment selected in netbeans does not recognize the latest rails gem but is using another one. Check with rails -v to see which version of rails you are running. If it is ok in the terminal, make sure you are running netbeans with the same user (ex. sudo or your user depending on the rvm config you have).
I had this problem several times with different IDE and every time it was because I was not using the proper user or not using the proper gemset in RVM (it's so easy to forget !)
After that it should be easy to resolve by choosing the right environment in the config of your project in netbeans or rubymine.