LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 09-24-2006, 03:30 PM   #1
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Rep: Reputation: 49
Getting started with Ruby on Rails


I am using OpenBSD and am trying to get started with Ruby on Rails.

I have installed lighttpd, ruby, ruby-gems and fastcgi, and via gems I have installed rails and fcgi.
I have followed the guides:
Lighttpd
RailsOnOpenBSD
GettingStartedWithRails
Tutorial in Ruby on Rails

I create a project in /var/www/
Code:
# rails testproject
I start lighttpd
Code:
# cd testproject
# ./script/server lighttpd
=> Booting lighttpd (use 'script/server webrick' to force WEBrick)
=> Rails application started on http://192.168.0.1:80
=> Call with -d to detach
=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)
Now I surf to http://192.168.0.1/ and I get a nice page saying I am running on rails.

Next I set up an application
Code:
# ./script/generate controller hello index
Surfing to http://192.168.0.1/hello shows a page saying Hello#index, etc... It works fine.

Now I change these files:
Code:
File: /var/www/testproject/apps/controllers/hello_controller.rb
class HelloController < ApplicationController

  def index
  end

  def world
    @greeting = "hello world!"
  end
end
Code:
File: /var/www/testproject/apps/views/hello/index.rhtml
<h1>Hello#index</h1>
<%= @greeting %>
Now when I surf to http://192.168.0.1/hello all I get is Hello#index but no "hello world". When I check the page source I see this:
Code:
<h1>Hello#index</h1>
and in the console this shows up:
Code:
Processing HelloController#index (for 192.168.0.33 at 2006-09-24 22:26:42) [GET]
  Session ID: a51585872d8e13bfaf3c424a1d9fcbf3
  Parameters: {"action"=>"index", "controller"=>"hello"}
Rendering hello/index
Completed in 0.24990 (4 reqs/sec) | Rendering: 0.09091 (36%) | 200 OK [http://192.168.0.1/hello]
Something is wrong. But what?
 
Old 09-24-2006, 03:40 PM   #2
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Original Poster
Rep: Reputation: 49
Eureka!

It seems that the problem was easy (even though no one at #rubyonrails at freenode knew the answer (?)):

I did not surf to hostname/hello/world, if I put the @greeting-variable in the index def instead it showed up fine. Sooo simple, but still.. no help from the guys at irc. :P
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you help me with search in Ruby on Rails? viniosity Programming 1 01-05-2007 06:25 PM
LXer: Ruby on Rails LXer Syndicated Linux News 0 07-03-2006 07:54 PM
Ruby on Rails, on Linux. After the install... caledfwlch Programming 1 06-24-2006 11:47 PM
LXer: Ruby on Rails LXer Syndicated Linux News 0 02-16-2006 04:16 PM
LXer: Ruby off the Rails LXer Syndicated Linux News 0 12-24-2005 04:31 PM


All times are GMT -5. The time now is 07:51 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration