rails command doesn't work - ruby-on-rails-3

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 :)

Related

redmine.org not running after updated the ruby

Ruby updated to version 1.8.7 and the redmine display at the top right side "Not Running" The issue that I found is that doesn't send mailing alerts to users when the status of one task change.
The redmine save tasks normally.
Do you know why I get "Not running"?
Do you know how can I found what is not running?
Do you know how the mail alerts will work as before?
Also the redmine is hosted in cPanel.
First of all your Ruby version is very old and non-maintaned, you should look for 2.4.x versions.
I recommend that you install new ruby via rvm or rbenv
So if you are to proceed with RVM, it's easy to install via console, it first imports the key
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
And then installs via curl and bash (your should ask for permission to use bash, because often with cpanel, the only shell users can use is some kind of jailshell)
\curl -sSL https://get.rvm.io | bash -s stable
Once RVM is installed, you will be able to install new ruby for that particular user, by typing rvm install rubyversion replace rubyversion with one of your choice.
And then proceed with Redmine upgrade, as explained in manual
http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade
Once you are done with that, you must figure out, how is your redmine being served, I assume it's served as fcgi module, since it's old version of ruby, so you might have to seek for a way to run your Redmine with new ruby, I recommend to try this approach first How to get rvm running inside fcgi?
There are several ways to deploy rails app like Redmine on a web-server, however running under cpanel gives you little or no choices, alternative would be to run some server like thin, or webrick, and proxy it thru apache, which should be possible with cpanel.

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.

Cannot call method 'charAt' of undefined - only on server

I have a rails application which is running well in local (OsX, WEBrick).
I've cloned the repo on a server (Ubuntu 10.04, Apache, Passenger), setted up passenger, but now when i try to connect to every page i get
Less::ParseError in Pages#home
Showing /var/www/MYAPP/app/views/layouts/application.html.erb where line #5 raised:
Cannot call method 'charAt' of undefined
(in /usr/lib/ruby/gems/1.8/gems/twitter-bootstrap-rails-2.0.2/vendor/assets/stylesheets/twitter/bootstrap.css.less)
the content of bootstrap.css.less is:
#import "twitter/bootstrap/bootstrap";
line 5 of application.html.erb is:
<%= stylesheet_link_tag "application" %>
ruby 1.8.7 on both machines
solved upgrading to ruby 1.9.3
Upgrading less worked for me on Ubuntu server 10.04
For system wide:
sudo npm -g install less
For user only:
npm install less
I believe this has something to do with the Ruby less gem not compiling it correctly. I had this problem locally on mac as well. Somewhere I saw a suggestion to use the node version of less (1.3) instead of the ruby gem, which you can install with npm install less.
However, most of the gems that hook up bootstrap to rails use the ruby gem version, so it seemed like a no go, esp on heroku etc. After a very frustrating couple of days on this I gave up and switch to the sass version of bootstrap: https://github.com/thomas-mcdonald/bootstrap-sass
It was simpler to integrate with rails, but unfortunate to be off the official version of bootstrap. I later went to integrate bootswatch but this doesn't play well with sass either. So I'm back to the plain old css version of bootswatch for now until a better way to handle this comes out :/

Running Rails server on ubuntu

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.

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.