#6 楼 @linjunhalida 可 post 没有 delete 方法呀。
#4 楼 @linjunhalida config/route.rb:::::::::
resources :posts do
resources :comments
end
<% @post.comments.each do |comment| %>
<p><%= comment.user -%>:<%= comment.body %> </p>
<% if session[:user_name] == "rails" -%>
<div class="edit_link">
<%= link_to '删除', [comment.post, comment], :confirm => 'Are you sure?',
:method => :delete,
:action => "show",
:controller => "post" -%>
</div>
<% end -%>
<% end %>
#9 楼 @Ryan 点击 blog 超链接只有提示:::
undefined method
posts' for nil:NilClass`
Extracted source (around line #17):
14: <%= nav_link '帮助', 'site', 'help' -%>
15: </span>
16: <span style="float:right">
17: <% if session[:user_id] -%>
18: <%= nav_link '个人中心','user','index' -%> |
19: <%= link_to 'blog', blog_posts_path(@blog.posts) -%> |
20: <%= nav_link '登出','user','logout' -%>
我也分不清....
#23 楼 @ShiningRay no,redhat.but there's no package libmysqlclient-dev
#19 楼 @ShiningRay it worked!!! Really really appretiate for your help! but here's another problem.I created a rails project,installed mysql,updated the /config/database.yml to support mysql instead of sqlite3. when "rails server",it appears as the following:::: Could not find gem 'mysql2 (>= 0) ruby' in the gems available on this machine. Run bundle install to install missing gems.
but type "bundle install" still fails:: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/liuzhou/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb
checking for mysql_ssl_set()... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
what should i do????please help!
#19 楼 @ShiningRay Thanks a lot!! I'm trying!!
It's hard to finish the project...
#15 楼 @ShiningRay could you please tell me how to solve the problem @#14lou
I "rails testweb",then "cd testweb",then "ruby script/server"..and something goes wrong,here's the following description: => Booting WEBrick => Rails 2.3.14 application starting on http://0.0.0.0:3000 /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21:in add_frozen_gem_path': undefined methodsource_index' for Gem:Module (NoMethodError) from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:298:in add_gem_load_paths' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:132:inprocess' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:in send' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:inrun' from /home/liuzhou/testweb/config/environment.rb:9 from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:inrequire' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in require' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:547:innew_constants_in' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in require' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/commands/server.rb:84 from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:ingem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in `require' from script/server:3
thank you for you help...
I "rails testweb",then "cd testweb",then "ruby script/server"..and something goes wrong,here's the following description: => Booting WEBrick => Rails 2.3.14 application starting on http://0.0.0.0:3000 /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21:in add_frozen_gem_path': undefined methodsource_index' for Gem:Module (NoMethodError) from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:298:in add_gem_load_paths' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:132:inprocess' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:in send' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:inrun' from /home/liuzhou/testweb/config/environment.rb:9 from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:inrequire' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in require' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:547:innew_constants_in' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in require' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/commands/server.rb:84 from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:ingem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in `require' from script/server:3
thank you for you help...
I "rails testweb",then "cd testweb",then "ruby script/server"..and something goes wrong,here's the following description: => Booting WEBrick => Rails 2.3.14 application starting on http://0.0.0.0:3000 /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21:in add_frozen_gem_path': undefined methodsource_index' for Gem:Module (NoMethodError) from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:298:in add_gem_load_paths' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:132:inprocess' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:in send' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:inrun' from /home/liuzhou/testweb/config/environment.rb:9 from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:inrequire' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in require' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:547:innew_constants_in' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in require' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/commands/server.rb:84 from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:ingem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in `require' from script/server:3
thank you for you help...
I "rails testweb",then "cd testweb",then "ruby script/server"..and something goes wrong,here's the following description: => Booting WEBrick => Rails 2.3.14 application starting on http://0.0.0.0:3000 /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21:in add_frozen_gem_path': undefined methodsource_index' for Gem:Module (NoMethodError) from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:298:in add_gem_load_paths' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:132:inprocess' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:in send' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:inrun' from /home/liuzhou/testweb/config/environment.rb:9 from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:inrequire' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in require' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:547:innew_constants_in' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in require' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/commands/server.rb:84 from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:ingem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in `require' from script/server:3
thank you for you help...
谁能告诉我这个要怎么解决??? 我已经把 sqlite3.dll 放到 C:\WINDOWS 和 Ruby 的 bin 目录底下了!