Error when trying to run expense program


#1

Guys, I m trying to get up to speed on Rails via the Apple tutorial
at:http://developer.apple.com/tools/rubyonrails.html

Problem is when I try and access localhost:3000/expenses I get the
following error. It may be a breeze for you to figure out but since I
dont know jack about rails it seems cryptic to me. Application.rb seems
to be very similar to the database.yml file.

I’m running everything on Mac (mysql)

Cheers

./script/…/config/…/app/controllers/application.rb:5: syntax error,
unexpected ‘:’, expecting kEND
./script/…/config/…/app/controllers/application.rb:7: syntax error,
unexpected ‘:’, expecting kEND
database: expenses_development
^
./script/…/config/…/app/controllers/application.rb:8: syntax error,
unexpected ‘:’, expecting kEND
username: root
^
./script/…/config/…/app/controllers/application.rb:9: syntax error,
unexpected ‘:’, expecting kEND
./script/…/config/…/app/controllers/application.rb:10: unknown regexp
options - yql
./script/…/config/…/app/controllers/application.rb:15: syntax error,
unexpected ‘:’, expecting kEND
./script/…/config/…/app/controllers/application.rb:17: syntax error,
unexpected ‘:’, expecting kEND
database: expenses_development
^
./script/…/config/…/app/controllers/application.rb:18: syntax error,
unexpected ‘:’, expecting kEND
username: root
^
./script/…/config/…/app/controllers/application.rb:19: syntax error,
unexpected ‘:’, expecting kEND
./script/…/config/…/app/controllers/application.rb:20: unknown regexp
options - yql
./script/…/config/…/app/controllers/application.rb:22: syntax error,
unexpected ‘:’, expecting kEND
./script/…/config/…/app/controllers/application.rb:24: syntax error,
unexpected ‘:’, expecting kEND
database: expenses_production
^
./script/…/config/…/app/controllers/application.rb:25: syntax error,
unexpected ‘:’, expecting kEND
username: root
^
./script/…/config/…/app/controllers/application.rb:26: syntax error,
unexpected ‘:’, expecting kEND
password:
^
./script/…/config/…/app/controllers/application.rb:27: unknown regexp
options - yql
./script/…/config/…/app/controllers/application.rb:28: syntax error,
unexpected ‘<’, expecting kEND
< ActionController::Base
^
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:203:in
load_without_new_constant_marking' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:203:inload_file’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in
new_constants_in' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:202:inload_file’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:94:in
require_or_load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:60:independ_on’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:442:in
require_dependency' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:110:inprepare_application’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:39:in
dispatch' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:78:inprocess’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:76:in
synchronize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:76:inprocess’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:618:in
process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:ineach’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in
process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:inrun’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
initialize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:innew’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:ininitialize’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in
new' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:inrun’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:271:in
run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:270:ineach’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:270:in
run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:127:inrun’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/command.rb:211:in
run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:243 /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:inload’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in
load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:innew_constants_in’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in
load' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:60 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:inrequire’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in
new_constants_in' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:inrequire’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
script/server:3


#2

in a new rails app, application.rb begins life as an empty class,
something like:
class ApplicationController < ActionController::Base

Pick a unique cookie name to distinguish our session data from

others’
session :session_key => ‘_myapp_session_id’
end

so unless this expenses app of yours has put code in application.rb,
yours should be about the same.

judging by the errors below it sounds like you have yml syntax in in a
ruby file. the yml should be in a .yml file… database.yml typically
looks like

development:
database: myapp_development
username: root
password:

test:
database: myapp_test
username: root
password:

if you’re new to ruby and rails, then the yml syntax of “key: value”
can be confusing next to ruby/rails “some_method :symbol”… subtle
difference in the position of the colon. hang in there and you’ll get
it.


#3

Dude, you rock for volunteering to respond. And I havent even read your
response yet! I’ll look into making the changes you outlined and get
back to you brah.

thanks
Fahd

Jeff Emminger wrote:

in a new rails app, application.rb begins life as an empty class,
something like:
class ApplicationController < ActionController::Base

Pick a unique cookie name to distinguish our session data from

others’
session :session_key => ‘_myapp_session_id’
end

so unless this expenses app of yours has put code in application.rb,
yours should be about the same.

judging by the errors below it sounds like you have yml syntax in in a
ruby file. the yml should be in a .yml file… database.yml typically
looks like

development:
database: myapp_development
username: root
password:

test:
database: myapp_test
username: root
password:

if you’re new to ruby and rails, then the yml syntax of “key: value”
can be confusing next to ruby/rails “some_method :symbol”… subtle
difference in the position of the colon. hang in there and you’ll get
it.