贯穿杰夫摩根:黄瓜和奶酪,一切正常,直到我到达CH6数据库。 去了cheezyworld,下载并解压缩app。
8300:~/cheezy2/puppies$ bundle install
Fetching gem metadata from http://rubygems.org/...........
Fetching version metadata from http://rubygems.org/...
Fetching dependency metadata from http://rubygems.org/..
Could not find addressable-2.3.1 in any of the sources
我搜索并通过另一个版本的可解决的2.3.1错误,但这导致了更多的问题。我的下一步是转到github获取最新的小狗应用程序github cheezy小狗,我已经尝试了下载zip和克隆。
我的环境:(注意,我刚刚开始使用Ruby等人)
Ubuntu 14.04
Rubymine IDE,这是一个命令行问题
问题:
谢谢 - 详情如下
拉开dir并打开它后,我得到了:
8300:~/cheezy$ cd puppies
You are using '.rvmrc', it requires trusting, it is slower and it is not
compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version'
or ignore this warning with
'rvm rvmrc warning ignore /home/user/cheezy/puppies/.rvmrc',
'.rvmrc' will continue to be the default project
file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning
ignore all.rvmrcs'.
我搜索并发现我应该这样做:
8300:~/cheezy/puppies$ rvm rvmrc warning ignore all.rvmrcs
8300:~/cheezy/puppies$ bundle install
然后我做了rails s
8300:~/cheezy/puppies$ rails s
=> Booting WEBrick
=> Rails 3.2.11 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2015-09-17 14:31:26] INFO WEBrick 1.3.1
[2015-09-17 14:31:26] INFO ruby 1.9.3 (2012-04-20) [x86_64-linux]
[2015-09-17 14:31:26] INFO WEBrick::HTTPServer#start: pid=26994 port=3000
根据这本书,以上是正确的。但是,当我转到网址时 本地主机:3000
我在控制台看到错误:
Started GET "/" for 127.0.0.1 at 2015-09-17 14:31:59 -0700
Connecting to database specified by database.yml
Processing by AgencyController#index as HTML
Rendered agency/index.html.erb within layouts/application (19.8ms)
Completed 500 Internal Server Error in 43ms
ActionView::Template::Error (Could not find table 'puppies'):
4:
5: <h1>Puppy List</h1>
6:
7: <% @puppies.each do |puppy| -%>
8: <div class="puppy_list">
9: <div class='<%= cycle('list_line_odd', 'list_line_even') %>'>
10: <div class="image"><%= image_tag(puppy.image_url, :class => 'list_image') %></div>
app/views/agency/index.html.erb:7:in `_app_views_agency_index_html_erb___380271329036758088_31446620'
Rendered /home/user/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.11/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered /home/user/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.11/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.7ms)
Rendered /home/user/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.11/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (5.6ms)
在浏览器中我收到错误页面
ActiveRecord::StatementInvalid in Agency#index
Showing /home/user/cheezy/puppies/app/views/agency/index.html.erb where line #7 raised:
Could not find table 'puppies'
我跑了rvm list:
:~/.rvm/gems$ rvm list
Warning! PATH is not properly set up, '/home/userid/.rvm/gems/ruby-2.2.2/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.2.2'.
rvm rubies
ruby-1.9.3-p194 [ x86_64 ]
ruby-2.0.0-p643 [ x86_64 ]
ruby-2.1.2 [ x86_64 ]
ruby-2.2.1 [ x86_64 ]
=* ruby-2.2.2 [ x86_64 ]
# => - current
# =* - current && default
# * - default
答案 0 :(得分:1)
如果您正在关注黄瓜和奶酪书: