Questions tagged «railstutorial.org»

5
不再支持对Rake DSL方法的全局访问
我正在研究Ruby on Rails 3教程,并在命令行中键入了以下内容: rake db:migrate 产生了以下警告。 WARNING: Global access to Rake DSL methods is deprecated. Please Include ... Rake::DSL into classes and modules which use the Rake DSL methods. WARNING: DSL method DemoApp::Application#task called at /Users/imac/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks' 我不确定该怎么做或如何使用它。我不知道Rake有其他命令。 我该如何解决这个问题?

3
对“ respond_to”和“ respond_to”感到困惑?
我正在用railstutorial.org学习Rails,并且对某些事情感到困惑:在本章中,作者告诉我们respond_to?使用User对象上的方法在控制台中进行一些测试,并且工作正常。但是后来,当我们为该:encrypted_password属性编写测试时,他使用respond_to。 出于好奇,我respond_to在控制台中尝试了一个User对象,但收到一条错误消息,指出该方法不存在。,如果我尝试使用respond_to?而不是编写测试respond_to,则测试不会运行。 有人可以解释一下两者之间的区别,为什么测试只能与之一起运行respond_to?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.