Help geting started

Hi

I am reading O’Reilly Rails Cookbook, but I can not get the examples
working. Here is what I have done so far:

rails mytest --database=mysql

ruby script/generate migration build_db
–BuildDb class–
class BuildDb < ActiveRecord::Migration
def self.up
create_table :schedules, :force => true do |t|
t.column :scheduleTime, :datetime
t.column :repeatEveryYear, :boolean
t.column :message, :string

  t.timestamps
end

end

def self.down
drop_table :schedules
end
end
–BuildDb class–

rake db:migrate

ruby script/generate model schedules (generates a new empty migration,
I deleted it)

ruby script/generate controller schedules

Edited my controller, and added: scaffold :schedules

But when I try to test my application, the mongrel log gives me this:

Wed Aug 11 12:06:10 +0200 2010: Error calling Dispatcher.dispatch
#<NoMethodError: You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split>
/Users/sneigaard/.gem/ruby/1.8/gems/actionpack-2.3.8/lib/
action_controller/cgi_process.rb:52:in dispatch_cgi' /Users/sneigaard/.gem/ruby/1.8/gems/actionpack-2.3.8/lib/ action_controller/dispatcher.rb:101:indispatch_cgi’
/Users/sneigaard/.gem/ruby/1.8/gems/actionpack-2.3.8/lib/
action_controller/dispatcher.rb:27:in dispatch' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb: 76:inprocess’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/rails.rb:
74:in synchronize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb: 74:inprocess’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:159:in
process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:ineach’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:158:in
process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:inrun’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:285:in
initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:innew’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:285:in
run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:ininitialize’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:268:in
new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:inrun’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/
configurator.rb:282:in run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ configurator.rb:281:ineach’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/
configurator.rb:281:in run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:inrun’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/
command.rb:212:in run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 /usr/bin/mongrel_rails:19:inload’
/usr/bin/mongrel_rails:19

Hm well should this not work?

Thank you
Søren

On 11 August 2010 11:13, neigaard [email protected] wrote:

Hi

I am reading O’Reilly Rails Cookbook, but I can not get the examples
working.

That’s not really a beginners tutorial book - it’s more for reference
on how to deal with specific problems.
You may be better off with a book like “Agile Web D. With
Rails”, which does take you through from first principles.

Also, I’m not sure how up-to-date the Cookbook is (mine’s for Rails
1.2 I think!), and it looks like you’re running 2.3.8, so that may be
part of the problems you’re having.

neigaard wrote:

Hi

I am reading O’Reilly Rails Cookbook, but I can not get the examples
working. Here is what I have done so far:

rails mytest --database=mysql

Maybe you should start Rails learning by following
http://guides.rubyonrails.org/’ site.

Thanks,
Anubhaw

On 08/11/2010 12:13 PM, neigaard wrote:

Hi

I am reading O’Reilly Rails Cookbook, but I can not get the examples
working. Here is what I have done so far:

Hey,

I also just started learning rails. First I’ve read “The well grounded
Rubyist” to learn the language itself and now I’m reading “Agile Web
Development with Rails”.

Cheers,

Jan

Well, I am now reading
http://guides.rubyonrails.org/getting_started.html
(also tried Agile Web D. with Rails), but I do not get very
far. I follow the guide to chapter 4.1, but when I point my browser to
http://localhost:3000/home/index I get a blank page and the following
in mongrel.log:

Fri Aug 13 12:20:22 +0200 2010: Error calling Dispatcher.dispatch
#<NoMethodError: You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split>
/Users/sneigaard/.gem/ruby/1.8/gems/actionpack-2.3.8/lib/
action_controller/cgi_process.rb:52:in dispatch_cgi' /Users/sneigaard/.gem/ruby/1.8/gems/actionpack-2.3.8/lib/ action_controller/dispatcher.rb:101:indispatch_cgi’
/Users/sneigaard/.gem/ruby/1.8/gems/actionpack-2.3.8/lib/
action_controller/dispatcher.rb:27:in dispatch' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb: 76:inprocess’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/rails.rb:
74:in synchronize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb: 74:inprocess’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:159:in
process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:ineach’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:158:in
process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:inrun’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:285:in
initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:innew’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:285:in
run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:ininitialize’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:268:in
new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:inrun’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/
configurator.rb:282:in run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ configurator.rb:281:ineach’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/
configurator.rb:281:in run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:inrun’
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/
command.rb:212:in run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 /usr/bin/mongrel_rails:19:inload’
/usr/bin/mongrel_rails:19

Any ideas? Is my rails setup broken? I am runing on OS X 10.6.4, is it
is broken, then how can I uninstall it all and reinstall?

Thank you
Søren

Ok I tested some more, and I found out that it works with the webrick
(ruby script/server webrick) server, so my mongrel must be broken some
how? I did a:

sudo gem uninstall fastthread
sudo gem uninstall mongrel
sudo gem install mongrel

But still I get the same error with mongrel. Well I can work with
webrick, but I sure would like to know what is wrong with my mongrel.

Thank you
Søren

you can also take a look at this http://railstutorial.org/book

http://railstutorial.org/bookas far as you environment being broken
that’s
hard to tell without more information

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs