Rails 敏捷开发 4 问题

zhang991228752 · 2012年11月30日 · 最后由 zhang991228752 回复于 2012年12月01日 · 3278 次阅读

然后就这样了 Started POST "/line_items?product_id=20" for 127.0.0.1 at Sat Dec 01 00:19:06 +0800 2012 Processing by LineItemsController#create as HTML Parameters: {"authenticity_token"=>"kVYk1QwvgXragCU1Xq6il4ssMIYI52RRE1XehSWVKsU=", "product_id"=>"20"} (0.1ms) begin transaction SQL (0.3ms) INSERT INTO "carts" ("created_at", "updated_at") VALUES (?, ?) ["created_at", Fri, 30 Nov 2012 16:19:06 UTC +00:00], ["updated_at", Fri, 30 Nov 2012 16:19:06 UTC +00:00] commit transaction Product Load (0.1ms) SELECT "products".* FROM "products" WHERE "products"."id" = ? ORDER BY title LIMIT 1 ["id", "20"] begin transaction SQL (0.3ms) INSERT INTO "line_items" ("cart_id", "created_at", "product_id", "updated_at") VALUES (?, ?, ?, ?) ["cart_id", 70], ["created_at", Fri, 30 Nov 2012 16:19:06 UTC +00:00], ["product_id", 20], ["updated_at", Fri, 30 Nov 2012 16:19:06 UTC +00:00] commit transaction Cart Load (0.2ms) SELECT "carts".* FROM "carts" WHERE "carts"."id" = 70 LIMIT 1 Redirected to http://0000:3000/carts/70 Completed 302 Found in 234ms (ActiveRecord: 224.6ms) [2012-12-01 00:19:06] ERROR URI::InvalidURIError: the scheme http does not accept registry part: 0000:3000 (or bad hostname?) /home/my/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/uri/generic.rb:732:in merge' /home/my/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/httpresponse.rb:164:insetup_header' /home/my/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/httpresponse.rb:102:in send_response' /home/my/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/httpserver.rb:79:inrun' /home/my/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:173:in start_thread' /home/my/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:162:instart' /home/my/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:162:in start_thread' /home/my/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:95:instart' /home/my/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:92:in each' /home/my/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:92:instart' /home/my/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:23:in start' /home/my/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/1.8/webrick/server.rb:82:instart' /home/my/.rvm/gems/ruby-1.8.7-p370/gems/rack-1.4.1/lib/rack/handler/webrick.rb:13:in run' /home/my/.rvm/gems/ruby-1.8.7-p370/gems/rack-1.4.1/lib/rack/server.rb:265:instart' /home/my/.rvm/gems/ruby-1.8.7-p370/gems/railties-3.2.9/lib/rails/commands/server.rb:70:in start' /home/my/.rvm/gems/ruby-1.8.7-p370/gems/railties-3.2.9/lib/rails/commands.rb:55 /home/my/.rvm/gems/ruby-1.8.7-p370/gems/railties-3.2.9/lib/rails/commands.rb:50:intap' /home/my/.rvm/gems/ruby-1.8.7-p370/gems/railties-3.2.9/lib/rails/commands.rb:50 script/rails:6:in `require' script/rails:6

不太明白啊,这个和“敏捷开发 4 问题”有什么关系吗?

日志什么呢?启动服务的窗口有什么相关日志吗?

TCPServer Error: Address already in use - bind(2)

你代码敲错了吧啊,上面那个是地址错误啊,具体不清楚,下面那个是服务器的地址已经有一个进程使用了。源码在这里有下 http://pragprog.com/titles/rails4/source_code

@guyanbiao 谢谢你提供的源码 Thank you!!!!

地址栏的应该是 0.0.0.0:3000 吧,你的是 0000:3000,怎么回事

这个问题在 google 游览器下不会出现

需要 登录 后方可回复, 如果你还没有账号请 注册新账号