Witam, właśnie zakupiłem sobie książkę “RailsSpace - Tworzenie społecznościowych serwisów internetowych w Ruby on Rails”.
Chciałbym realizować treść tej książki pod najnowszą wersją Rubiego i Railsów, jednakże już na samym początku mam pewne problemy - chciałbym w tym temacie kolejno zwracać się do Was z pytaniami jak je rozwiązać (jeżeli sam nie podołam ich rozwiązaniu - a jestem bardzo początkujący w RoR).
Od razu zaznaczę, że działam na Windows 7, Rails 3.0.5.
Pierwszy problem był już przy tworzeniu nowego projektu (w książce kazali użyć nie obsługiwanego już polecenia
rails -d mysql rails_space
zamiast
rails new rails_space
Kolejnym problemem - na którym niestety się zatrzymałem jest zmienianie trasy - wpisanie do pliku config/routes.rb linii:
map.root '', :controller => "site"
Niestety, po wpisaniu tej linii serwer odmawia współpracy - na chwilę startuje i po chwili przerywa pracę i konsola wyrzuca mi komunikat:
C:\Sites\rails_space>rails server
=> Booting WEBrick
=> Rails 3.0.5 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
C:/Sites/rails_space/config/routes.rb:8: undefined local variable or method `map
' for #<ActionDispatch::Routing::Mapper:0x700e2e8> (NameError)
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/actionpack-3.0.5
/lib/action_dispatch/routing/route_set.rb:233:in `instance_exec'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/actionpack-3.0.5
/lib/action_dispatch/routing/route_set.rb:233:in `draw'
from C:/Sites/rails_space/config/routes.rb:1
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.
0.5/lib/active_support/dependencies.rb:235:in `load'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.
0.5/lib/active_support/dependencies.rb:235:in `load'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.
0.5/lib/active_support/dependencies.rb:225:in `load_dependency'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.
0.5/lib/active_support/dependencies.rb:596:in `new_constants_in'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.
0.5/lib/active_support/dependencies.rb:225:in `load_dependency'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.
0.5/lib/active_support/dependencies.rb:235:in `load'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/application.rb:127:in `reload_routes!'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/application.rb:127:in `each'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/application.rb:127:in `reload_routes!'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/application.rb:120:in `routes_reloader'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.
0.5/lib/active_support/file_update_checker.rb:32:in `call'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.
0.5/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/application/finisher.rb:51
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/application/finisher.rb:52:in `call'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/application/finisher.rb:52
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/initializable.rb:25:in `instance_exec'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/initializable.rb:25:in `run'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/initializable.rb:50:in `run_initializers'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/initializable.rb:49:in `each'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/initializable.rb:49:in `run_initializers'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/application.rb:134:in `initialize!'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/application.rb:77:in `send'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.5/l
ib/rails/application.rb:77:in `method_missing'
from C:/Sites/rails_space/config/environment.rb:5
from C:/Sites/rails_space/config.ru:3:in `require'
from C:/Sites/rails_space/config.ru:3
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/r
ack/builder.rb:46:in `instance_eval'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/r
ack/builder.rb:46:in `initialize'
from C:/Sites/rails_space/config.ru:1:in `new'
from C:/Sites/rails_space/config.ru:1
HELP!