Ruby on Rails new installation on Ubuntu , problem getting a new app to work (TypeError) !
Just installed RoR on Ubuntu 10.10 and created a new app, I get the welcome page, but when I create a simple index page I get TypeError. Here is what I have done:
following instructions available at https://help.ubuntu.com/community/RubyOnRails
Eveything looks fine no error during installation. I opted out for the built in web server to keep things simple.
I created a new app using:
/var/www/$ rails new mynewapp
and started the webserver in terminal:
/var/www/mynewapp/script$ rails server
=> Booting WEBrick
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-02-22 17:14:09] INFO WEBrick 1.3.1
[2011-02-22 17:14:09] INFO ruby 1.8.7 (2010-06-23) [i686-linux]
[2011-02-22 17:14:24] INFO WEBrick::HTTPServer#start: pid=10120 port=3000
I get the welcome page all right. Then I followed the tutorial at (http://guides.rubyonrails.org/getting_started.html) and created my index page:
/var/www/mynewapp$ rails generate controller home index
Then I edited the newlly created mynewapp/views/home/index.html.erb to add a bit of HTML. Then I edited mynewapp/config/routes.rb :
Blog::Application.routes.draw do
#...
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
root :to => "home#index"
Now when I browse to localhost:3000 instead of the welcome screen I get the following error on the browser:
TypeError
can't convert Fixnum into String
Rails.root: /var/www/mynewapp
and this appears in the terminal:
Started GET "/" for 127.0.0.开发者_如何转开发1 at Wed Feb 23 12:23:17 -0500 2011
TypeError (can't convert Fixnum into String):
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.1ms)
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.1ms)
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (6.5ms)
Do you know what am I doing wrong? Thx
Seems like there are some triubles with database. You can run "rake db:migrate --trace" and post the result, if you still have such problem?
Did you set the database password to be pure digit, like "111111"? My guess I should changed it to be non-numeric like "abcdef", it worked!
Similar to this: Can't convert Fixnum into String - Devise/sessions Controller issue
精彩评论