LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-28-2010, 01:39 AM   #1
CoderMan
Member
 
Registered: Jan 2009
Location: Gemini Capsule 25164
Distribution: Gentoo
Posts: 375
Blog Entries: 24

Rep: Reputation: 43
Ruby on Rails - Trouble Getting Started


I'm going through the Beta version of "Agile Web Development with Rails - 4th Edition". But I'm having difficulty with initial configuration on my Gentoo box. I started like so, basically following the book:

Code:
$ rails testrails
$ cd testrails
$ script/generate controller Say hello goodbye
This created files including app/controllers/say_controller.rb, app/views/say/hello.html.erb, and app/views/say/hello.html.erb
like the book said it would. So then I ran the server in a separate terminal:

Code:
$ script/server
Then I opened up a browser, but if I try to visit "http://localhost:3000/say/hello" all I get in the browser window is the message: "We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly."

If I visit "http://localhost:3000/" then I get a default index page, which says I need to edit "config/routes.rb" But none of the comments in routes.rb make any sense to me, so I am not sure what I need to put in it. The book hasn't mentioned anything about routes yet.
 
Old 06-28-2010, 02:48 PM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
My first question after reading this post is... do you know ruby? If not... rails is rough.

I would also take a look at the gentoo wiki on this one and the RoR wiki -- http://www.gentoo-wiki.info/HOWTO_RoR
 
Old 06-28-2010, 04:38 PM   #3
CoderMan
Member
 
Registered: Jan 2009
Location: Gemini Capsule 25164
Distribution: Gentoo
Posts: 375

Original Poster
Blog Entries: 24

Rep: Reputation: 43
Quote:
Originally Posted by rweaver View Post
My first question after reading this post is... do you know ruby? If not... rails is rough.

I would also take a look at the gentoo wiki on this one and the RoR wiki -- http://www.gentoo-wiki.info/HOWTO_RoR
Yes, I've known Ruby for about a month now. Sorry, should have been more specific. Here's the routes.rb file:

Code:
ActionController::Routing::Routes.draw do |map|
  # The priority is based upon order of creation: first created -> highest priority.

  # Sample of regular route:
  #   map.connect 'products/:id', :controller => 'catalog', :action => 'view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   map.resources :products

  # Sample resource route with options:
  #   map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }

  # Sample resource route with sub-resources:
  #   map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
  
  # Sample resource route with more complex sub-resources
  #   map.resources :products do |products|
  #     products.resources :comments
  #     products.resources :sales, :collection => { :recent => :get }
  #   end

  # Sample resource route within a namespace:
  #   map.namespace :admin do |admin|
  #     # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
  #     admin.resources :products
  #   end

  # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
  # map.root :controller => "welcome"

  # See how all your routes lay out with "rake routes"

  # Install the default routes as the lowest priority.
  # Note: These default routes make all actions in every controller accessible via GET requests. You should
  # consider removing or commenting them out if you're using named routes and resources.
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end
I don't have any trouble coding the examples given to me in the book, but when I start the rails server and try to view them in the browser, I only get that error message I mentioned. The default rails server page (at the root URL) says I need to adjust the routes.rb config file to my project, but I am not sure what it should be adjusted to. The only concepts I have learned from the book so far (and only a vague concept at that) is the "controller" and the "action". I don't know what the "id" or the "format" or the "product" or the "routes" and "resources" refer to. I suppose I'll get to that in the book eventually, but for now I just need to know enough to get the example app to display.

Last edited by CoderMan; 06-28-2010 at 04:39 PM.
 
Old 06-28-2010, 10:18 PM   #4
CoderMan
Member
 
Registered: Jan 2009
Location: Gemini Capsule 25164
Distribution: Gentoo
Posts: 375

Original Poster
Blog Entries: 24

Rep: Reputation: 43
Figured it out: Apparently rails needs to have some database software installed, and I overlooked this. I installed sqlite3-ruby from the Gentoo tree, and now everything seems to be working fine.
 
  


Reply



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
Any issues installing Ruby Gems and Ruby on Rails in Slackware? Lufbery Slackware 8 02-09-2011 07:22 PM
[SOLVED] [Ruby on Rails] backticks don't work under rails. bartonski Programming 1 09-08-2009 04:19 PM
PHP v Ruby/Ruby on Rails Neko_D Linux - General 4 02-08-2007 11:56 PM
Getting started with Ruby on Rails Ephracis Linux - Server 1 09-24-2006 03:40 PM
LXer: Ruby on Rails LXer Syndicated Linux News 0 07-03-2006 07:54 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:54 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration