Hi,
I'm completely new to ruby and working my way through the tutorial on
I've made a few pages to use, but when I open them in a web browser all I see is code.
For instance, my new.html.erb, the code of which is:
Hi,
I'm completely new to ruby and working my way through the tutorial on
I've made a few pages to use, but when I open them in a web browser all I see is code.
For instance, my new.html.erb, the code of which is:
Firstly which version of Rails are you using? In a terminal go to the top level of your rails application (the one with subfolders app, config and so on) and enter rails -v
Next make sure that the tutorial you are using is for that version (or at least the major version is the same). If not then use a different tutorial or rails version. You will have no end of problems trying to use a tutorial that does not match the version you are using. I would suggest that you should be using rails 3, then look at the getting started guide at http://guides.rubyonrails.org/ to get you going.
Colin
Interesting, rails -v gave me 2.3.5, so I tried running 'gem update rails' which gave me 'Nothing to update'
Then I tried 'gem install rails' which put several folders into /var/lib/gems/1.8/gems/ including a "rails-3.0.1" folder, get rails -v still gives me 2.3.5 and gem update rails still gives me 'Nothing to update'
Any ideas?
From your description, I'd be looking first at your webserver (Apache? Nginx?) to see if you've configured it correctly to serve Rails apps. Are you using Mogrel, Passenger, or something else?
Regards,
Nathan Domier wrote in post #958789:
Interesting, rails -v gave me 2.3.5,
Then please use a 2.3 tutorial. You'll only get frustrated if you try to use a 2.1 tutorial with Rails 2.3.
Best,
Then please use a 2.3 tutorial. You'll only get frustrated if you try to use a 2.1 tutorial with Rails 2.3.
I'd like to use rails 3 if that's the most recent, I'm just trying to get everything set up at the moment anyway.
From your description, I'd be looking first at your webserver (Apache? Nginx?) to see if you've configured it correctly to serve Rails apps. Are you using Mogrel, Passenger, or something else?
I'm running Apache, and I guess I don't have it configured to use rails.
How would I go about doing that? I looked through he modules but didn't see one for rails...
Also, I uninstalled ruby and railsi n hopes of remedying my previous situation, but now I've run into the following problem as well:
nathan@flatbox:~$ ruby -v The program 'ruby' is currently not installed. You can install it by typing: sudo apt-get install ruby
nathan@flatbox:~$ ruby1.9.1 -v ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]
nathan@flatbox:~$ gem install rails The program 'gem' can be found in the following packages: * rubygems1.8 * rubygems1.9.1 Try: sudo apt-get install <selected package>
nathan@flatbox:~$ sudo apt-get install rubygems1.9.1 Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'ruby1.9.1' instead of 'rubygems1.9.1' ruby1.9.1 is already the newest version. ruby1.9.1 set to manually installed. The following packages were automatically installed and are no longer required: libsdl-ttf2.0-0 libmodplug0c2 libsdl-mixer1.2 libjs-prototype libindicator0 libmikmod2 libsdl-net1.2 libappindicator0 wwwconfig-common libruby1.8 libboost-regex1.42.0 javascript-common libsmpeg0 Use 'apt-get autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
nathan@flatbox:~$ gem install rails The program 'gem' can be found in the following packages: * rubygems1.8 * rubygems1.9.1 Try: sudo apt-get install <selected package>
Could you not top post please, and remember to quote the email you are replying to, otherwise it is difficult to follow the thread
Interesting, rails -v gave me 2.3.5, so I tried running 'gem update rails' which gave me 'Nothing to update'
Then I tried 'gem install rails' which put several folders into /var/lib/gems/1.8/gems/ including a "rails-3.0.1" folder, get rails -v still gives me 2.3.5 and gem update rails still gives me 'Nothing to update'
Have a look at config/environment.rb (in your app) and I expect you will find a line something like RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
This says to use version 2.3.5 for the app (as this was the version available when you created it).
If you want to move to rails 3 I would suggest forgetting about that app and starting again with rails 3.
Colin
Could you not top post please, and remember to quote the email you are replying to, otherwise it is difficult to follow the thread
Sorry, what is top posting?
If you want to move to rails 3 I would suggest forgetting about that app and starting again with rails 3.
Alright, the app was just something was making in a tutorial for the wrong version anyway, I'll start over with something new.
I went ahead and ran 'sudo apt-get install ruby', which seems to have enabled gems. Still, when I run 'sudo gem install rails', I get "File not found: lib" as per below
nathan@flatbox:/var/lib$ sudo gem install rails Successfully installed activesupport-3.0.1
-other Successes-
Successfully installed rails-3.0.1 24 gems installed Installing ri documentation for activesupport-3.0.1... Installing ri documentation for builder-2.1.2... ERROR: While generating documentation for builder-2.1.2 ... MESSAGE: Unhandled special: Special: type=17, text="<!-- HI -->" ... RDOC args: --ri --op /var/lib/gems/1.8/doc/builder-2.1.2/ri --title Builder -- Easy XML Building --main README --line-numbers --quiet lib CHANGES Rakefile README doc/releases/builder-1.2.4.rdoc doc/releases/builder-2.0.0.rdoc doc/releases/builder-2.1.1.rdoc --title builder-2.1.2 Documentation (continuing with the rest of the installation) Installing ri documentation for i18n-0.4.2...
-other Successes-
Installing ri documentation for rails-3.0.1... File not found: lib
it would seem the install failed because: nathan@flatbox:/var/lib$ rails -v The program 'rails' is currently not installed. You can install it by typing: sudo apt-get install rails
Nathan Domier wrote in post #958829:
Then please use a 2.3 tutorial. You'll only get frustrated if you try to use a 2.1 tutorial with Rails 2.3.
I'd like to use rails 3 if that's the most recent, I'm just trying to get everything set up at the moment anyway.
Then you'll be even more frustrated with a 2.1 tutorial.
Best,
ok, I'm completely frustrated with the install process for gems and rails \.
apt-get install rubygems1.9.1 seems to work, but when I try to run gem, it says it's not installed.
To get gem to work, I have to apt-get ruby, which installs 1.8, instead of 1.9, yet enables the gem command.
Then, gem install rails seems to work, but when I try to run rails, it says it's not installed.
To get rails to work, I have to apt-get rails, which installs 2.3.5 instead of 3.
how do I get 1.9.2 and 3.0 working!?
T_T
Check your path, and see if gem is in it. Once you find gem, type gem env and see what you get. It should match up with the version of Ruby you have installed, but if it doesn't, as they say on Mythbusters, "Well, there's your problem right there."
Walter
You should not install rails from the Ubuntu repository. It is usually an older version. Just install ruby, install rubygems, then do a gem install rails. It should be on 3.0.
Also, you most surely doesn’t need Apache to try it out. Once everything is set up on rails 3, just go to your app and write ‘rails server’. It should fire a server on http://localhost:3000/
Hi Nathan,
from your previous posts I think you are using Ubuntu here is how I recently setup my stack on Ubuntu 10.04 (you may be on 10.10 since you actually have a Ruby 1.9.2-p0 package... 10.04 doesn't)
My setup consists of: - nginx for front-end web server - mysql for database - git for source control (optional) - memcached for caching and sessions (optional) - unicorn as ruby application server (you may want to consider nginx or apache with passenger since easier to setup) - ruby 1.9.2-p0 - god for monitoring (optional) - capistrano for deploy (optional) - rcov for codecoverage (optional) - compass (optional)
Run the following on the command line: $ sudo apt-get install nginx $ sudo apt-get install mysql-server libmysqlclient-dev $ sudo apt-get install git-core memcached $ sudo apt-get install ruby # your ruby package for 1.9.2 plus I installed the following addition packages: libhttp-access2-ruby libopenssl-ruby libreadline-ruby irb
Next installation of rubygems and needed gems $ wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz $ tar xzf rubygems-1.3.7.tgz $ cd rubygems-1.3.7; sudo ruby setup.rb Your gem executable probably will end up under /usr/bin/gem so make sure you have /usr/bin in your $PATH If not update your ~/.bashrc to contain in the end: export PATH=/usr/bin:$PATH
Ensure you have the right ruby and gem version. You should see something like this: $ ruby -v ruby 1.9.2dev (2010-07-02) [x86_64-linux] $ cat `which gem` | head -1 #!/usr/bin/ruby1.9.2
Continue with installation of gems $ sudo gem install --no-ri --no-rdoc god memcache-client unicorn rcov compass capistrano rack $ sudo gem install --no-ri --no-rdoc mysql -- --with-mysql-config=/usr/ bin/mysql_config
Now you should be able to generate a new rails application: $ rails new my_new_app
If you cd into your new app you must setup the database configuration and create the database. Even without this you should be able to: a) start the rails console $ rails console b) if above successful start a unicorn server $ unicorn_rails -p 8000
Setup your nginx server to serve your rails application, or if you are on the local machine you can access your application from a web browser on port 8000
Hope this gets you started...
Best, Daniel
Ah forgot, in your case you need rails itself I don't have it on my servers since packed within the application. $ sudo gem install rails
Lunks wrote in post #958901:
You should not install rails from the Ubuntu repository. It is usually an older version. Just install ruby, install rubygems, then do a gem install rails. It should be on 3.0.
Also, you most surely doesn't need Apache to try it out. Once everything is set up on rails 3, just go to your app and write 'rails server'. It should fire a server on http://localhost:3000/
I've finally got my rails install set up correctly
I played around with the localhost server, and it's great for testing
it, but for the project I'm working on I have to get rails set up on an
apache server...
Does anyone know how to configure it to display ruby correctly?
don't waste your time on rails 2.1, learn rails 3
good tutorial by Michael Hartl
more good stuff @ RailsGuides: http://guides.rubyonrails.org/
Rajinder Yadav wrote in post #959273:
Don’t use Apache in development, use something like Passenger Standalone, Unicorn, …
In production, you can just host with Apache/Nginx + Passenger: http://www.modrails.com/install.html
Just point your vhost config to the rails app public folder.
Best regards
Peter De Berdt