Topic: Having trouble with official Rails documentation

The tutorial I am following is located here:
http://guides.rubyonrails.org/getting_started.html

So, after using the following shell command:
script/generate controller home index

When I access localhost:3000/home/index, I should see the view created by the above command, correct? I get a page error. I find that a lot of the tutorials that I follow have many failures. Is it because I am running a newer version of Rails? Are there any up-to-date tutorials?

Re: Having trouble with official Rails documentation

Yeah some older versions of rails that tutorial were written with will give you grief. But what you described should work. What's the error you are receiving? Also what version of rails are you using?

Last edited by agm_ultimatex (2010-06-16 07:56:55)

Re: Having trouble with official Rails documentation

It says the page is not found.

Re: Having trouble with official Rails documentation

Do you see the rails default index page okay at localhost:3000?

I just tried the steps myself in rails 2.3.8, they work fine for me.

Re: Having trouble with official Rails documentation

yes, when I access localhost:3000, I can see the index.html file in the public folder fine.

Re: Having trouble with official Rails documentation

Copy and paste the stack trace in here, along with the exception message itself, should help us figure it out.

Re: Having trouble with official Rails documentation

It's not like a normal Rails error. The page shows up blank in Firefox.

Re: Having trouble with official Rails documentation

So when you type

script/server

and then go to localhost:3000, you see the rails index page. But then you go to localhost:3000/home/index you get file not found in firefox eh? That's very strange. A bad url in rails is usually handled by a Route not found exception. Given that you are passing a request to the rails server, you should never really run into a firefox error page. I'm assuming your server is indeed running and didnt crash or anything when you go to the URL?

Re: Having trouble with official Rails documentation

Okay, I tried this again in a Linux partition running Rails, Here are the commands I run in the exact order:
rails sample_app
cd sample_app
ruby script/generate controller Pages home contact
ruby script/server

The error in the browser is:


We're sorry, but something went wrong.

We've been notified about this issue and we'll take a look at it shortly.




The error in the terminal is:
/!\ FAILSAFE /!\  Sun Jun 20 21:07:38 +0200 2010
  Status: 500 Internal Server Error
  no such file to load -- sqlite3
    /opt/rubystack-2.0-0/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    /opt/rubystack-2.0-0/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'


There are more lines of error in the terminal above about activerecord, activesupport, actionpack, rails, etc.

Re: Having trouble with official Rails documentation

You don't have the sqlite3 gem installed. By default, rails uses sqlite for the database. You need to run:

sudo gem install sqlite3-ruby


Note that it's not a gem, but a driver built in C. You may need the ruby dev packages, or other packages as well. The other option is of course installing mysql, and changing your database.yml file to support that. If you create your rails app:

rails sample_app -d mysql

It will create a default database.yml file setup for mysql.


I don't know what distribution you're using, but this worked very well for me on ubuntu: https://help.ubuntu.com/community/RubyOnRails for setting up mysql

Re: Having trouble with official Rails documentation

maybe you forgot to script/server  or ruby script/server. use another terminal while the server is running