草庐IT

error-checking

全部标签

ruby-on-rails - 简单的 Rails 应用程序 : Error Cannot visit Integer

我正在尝试构建一个简单的Rails应用程序。Railsv3.2.22.5(这是一项要求)。我用PostgreSQL运行它。然而,当我启动服务器时,当我尝试从数据库中读取一个简单的帖子时出现以下错误。CannotvisitInteger跟踪将我带到下面的显示方法。更具体到第二行。我是Rails的新手,完全不知道如何解决这个问题。搜索网络已经没有成功。欢迎提出任何想法。defshow@post=Post.find(params[:id])respond_todo|format|format.html#show.html.erbformat.json{renderjson:@post}end

ruby-on-rails - Rails 3.0 & Ruby 1.9.2rc : Rake commands return 'already initialized constant' & stack level too deep errors. 任何想法

我正在尝试在Ubuntu10.04上运行Rails3beta4和Ruby1.9.2rc。它最初有效,但在完成我的第一个bundleinstall/package之后,我现在在所有Rails项目中都遇到以下错误。即使是基本的“railsnewtestproject”后跟一个rake也会显示错误消息。简而言之,我很难过。非常感谢任何有关可能导致此问题的帮助。我唯一注意到的事情——可能相关也可能不相关——是~/.bundle文件中的目录是ruby​​/1.9.1。我的机器上没有安装1.9.1-只有1.9.2rc。ruby-v带回1.9.2(in/home/john/Websites/sand

ruby-on-rails - 对象.有效?返回 false 但 object.errors.full_messages 为空

我对无法保存的对象感到困惑,简化模型是classSubscription"User",:foreign_key=>"user_id"has_many:transactions,:class_name=>"SubscriptionTransaction"validates_presence_of:first_name,:message=>"nepeutêtrevide"validates_presence_of:last_name,:message=>"nepeutêtrevide"validates_presence_of:card_number,:message=>"nepeutêt

ruby - cucumber / capybara 错误:参数 [0] 未定义(Selenium::WebDriver::Error::JavascriptError)

我已经通过终端运行我的测试一段时间了,没有任何问题。:cucumber创建\新建\Game.feature其中包含以下内容:Feature:CreateNewGameBackground:GivenIamloggedinScenario:Cleanup&NewGame01ThenIDeletealltestGames还有ruby:Given(/^Iamloggedin$/)doel=first("button[ttag='account_dropdown_btn']",:visible=>true)ifel.nil?logMeIn("user@user1.com","pa55w0rd"

ruby-on-rails - 为什么 Rspec 说 "Failure/Error: Unable to find matching line from backtrace"?

我在这里学习Rails教程:http://railstutorial.org/chapters/filling-in-the-layout#top当我运行“rspecspec/”时,我得到一堆如下所示的错误:1)LayoutLinksshouldhaveaHomepageat'/'Failure/Error:Unabletofindmatchinglinefrombacktracestackleveltoodeep#C:/Ruby19/lib/ruby/1.9.1/forwardable.rb:1852)LayoutLinksshouldhaveaContactpageat'/cont

ruby-on-rails - Rails 应用程序:Solr 抛出 RSolr::Error::Http - 执行搜索时未找到 404

非常迷茫,因为我没有对我的搜索进行任何更改,该搜索一直有效,但不知何故我休息了。作为Rails的新手,错误输出没有给我足够的细节来进行调试。下面的相关代码-询问您是否还想查看其他内容。home.html.slim(带有搜索表单的摘录)=form_tagsearch_venues_path,method::get,id:'search'do|f|.search-fields.span16p=text_field_tag:q,'',placeholder:"Searchforcoffee,hotel,etc",class:'span7search-field'p=text_field_ta

ruby - 安装 RVM : getting error "There was an error(23)."

我尝试安装RubyVersionManager(RVM)但没有成功。如何解决我遇到的这个错误?ubuntu@ip-172-31-0-20:/tmp$rvminstallruby-1.9.3-p484Searchingforbinaryrubies,thismighttakesometime.Nobinaryrubiesavailablefor:ubuntu/14.04/x86_64/ruby-1.9.3-p484.Continuingwithcompilation.Pleaseread'rvmhelpmount'togetmoreinformationonbinaryrubies.Ch

ruby-on-rails - 如何在 Rails 1.2.3 中使复选框默认为 "checked"?

如何使复选框在最初显示时默认为“已选中”?我还没有找到一种“Rails”方法来做到这一点(可行),所以我用JavaScript做到了。在Rails中有没有正确的方法来做到这一点?我正在使用Rails1.2.3。 最佳答案 Rails3.x=form_for(@user)do|f|=f.check_box:subscribe,{checked:true,...}这会将检查状态设置为true,应该可以正常工作。注意散列的ruby​​1.9.x语法,对于ruby​​1.8.x使用散列标记格式{:checked=>true,...}

ruby-on-rails - ruby rails : how to get error messages from a child resource displayed?

当我呈现XML模板时,我很难理解如何让Rails为验证失败的子资源显示明确的错误消息。假设我有以下类(class):classSchool/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i,:message=>"Youmustsupplyavalidemail"end现在,在Controller中,假设我们想要构建一个简单的API来允许我们添加一个新的学校,其中有一个学生(我再说一次,这是一个糟糕的例子,但发挥它的作用是为了问题)classSchoolsController@school.errors,:status=>:unprocessable_

ruby-on-rails - rails : HasManyThroughAssociationNotFoundError

我在使用has_manythrough关联时遇到问题。我一直收到这个异常:Article.find(1).warehouses.buildActiveRecord::HasManyThroughAssociationNotFoundError:Couldnotfindtheassociation:entriesinmodelArticle这些是涉及的模型:classArticle:entriesendclassWarehouse:entriesendclassEntry这是我的模式:create_table"articles",:force=>truedo|t|t.string"art