草庐IT

MACCHA_PATH

全部标签

ruby-on-rails - Rails model_path 路由错误,没有路由匹配 "model.2";应该是 "model/2"

我的路由路径似乎有问题。通常我应该能够做类似的事情我继续我的一天。无论出于何种原因,我都无法理解我的user_path不返回/user/:id就像我期望的那样。相反,它返回/user.:id为了对此进行测试,我使用以下代码加载了一部分。app/view/users/_test.html.rb这返回了本地主机:3000/测试#1/user.1/users/new/users/1/edit/user.1我不知道是什么导致了这种情况发生。edit_user_path(@user)工作完美,但节目没有。我读过RailsRoutingGuide从上到下大约三遍,我无法弄清楚。我发现最接近我的问题

ruby - 为什么我的 Ruby Git 脚本 Hook 使用错误的 $PATH 运行?

我正在使用RVM。我为一个项目写了一个Gitpre-commit钩子(Hook):#!/usr/bin/envrubyputsRUBY_VERSIONputs`echo$PATH`exit(1)Git运行时输出:$gitci-m'foo'1.8.7/usr/libexec/git-core:/usr/bin:/usr/local/heroku/bin:/Users/mgoerlich/.rvm/gems/ruby-2.0.0-p195@global/bin:/Users/mgoerlich/.rvm/rubies/ruby-2.0.0-p195/bin:/Users/mgoerlich

ruby-on-rails - 如何在 Rails 3 的功能测试中使用 polymorphic_path

我正在尝试在Rails3的功能测试中使用polymorphic_path。起初我会得到NoMethodError:undefinedmethod`polymorphic_path'for#然后我添加了includeRails.application.routes.url_helpersundefinedmethoderror停止了,但是现在常规路径,例如article_path(article)停止工作了:NameError:undefinedlocalvariableormethod`default_url_options'for#.rvm/gems/ruby-1.9.2-p290/

ruby - Windows 7 - 如何解决 “You need to have Ruby and Sass installed and in your PATH for this task to work” 警告?

大多数答案和解决方案都与OSX相关,它集中在Windows7中:我已经全局安装了Grunt&GruntCLI。然后我在项目文件夹中执行了npminstall以安装所有依赖项。到目前为止没有问题,但是当我尝试运行“gruntbuild”命令时,我在我的项目中收到了这个警告:Warning:YouneedtohaveRubyandSassinstalledandinyourPATHforthistasktowork.Moreinfo:https://github.com/gruntjs/grunt-contrib-sassUse--forcetocontinue.

ruby - 将 RVM 与 virtualenv 一起使用时为 "Warning! PATH is not properly set up"

我收到这个错误:Warning!PATHisnotproperlysetup,'/home/oscar/.rvm/gems/ruby-2.1.2/bin'isnotatfirstplace,usuallythisiscausedbyshellinitializationfiles-checkthemfor'PATH=...'entries,itmightalsohelptore-addRVMtoyourdotfiles:'rvmgetstable--auto-dotfiles',tofixtemporarilyinthisshellsessionrun:'rvmuseruby-2.1.

ruby-on-rails - 带有 path_prefix 的浅层路由?

最近我在我的一个应用程序中更改了一些嵌套资源以使用浅层路由。它运行良好,我已经能够简化我的View和Controller。但是,我之前一直在使用path_prefix:map.with_options:path_prefix=>"blog"do|blog|blog.resources:postsdo|posts|posts.resources:commentsendend请注意,所有路由都按预期以“/blog”为前缀。#$rakeroutes#postsGET/blog/posts(.:format){:controller=>"posts",:action=>"index"}#POS

ruby-on-rails - 确定 Journey::Path::Pattern 是否匹配当前页面

我正在尝试使用概述的方法thispost结合url_for来确定当前路径是否在已安装的引擎中,但我很难弄清楚如何使用Journey::Path::Pattern(这是另一篇文章中概述的mounted_pa​​th方法返回的内容)。classRails::Enginedefself.mounted_pathroute=Rails.application.routes.routes.detectdo|route|route.app==selfendroute&&route.pathendend除了theofficialdocumentation,似乎没有太多关于它的讨论。,这不是特别有用。

ruby-on-rails - Heroku "at=error code=H10 desc="应用程序崩溃“method=GET path=/favicon.ico”

我有一个简单的Rails应用程序,可以在本地主机(MacOSX)上正常运行,但是当我将它部署到Heroku时,我看到一个页面出现此错误:应用程序错误应用程序发生错误,无法提供您的页面。请稍后重试。如果您是应用程序所有者,请查看您的日志以了解详细信息。我真的不知道我在这里做什么;我无法理解herokulogs的输出:2013-04-08T03:25:02+00:00app[web.1]:=>BootingWEBrick2013-04-08T03:25:02+00:00app[web.1]:=>Rails3.2.12applicationstartinginproductiononhttp

ruby-on-rails - 如何使用 cache_path 使 caches_action 过期?

我正在使用以下缓存索引操作:caches_action:index,:cache_path=>Proc.new{|c|c.params}expire_action:action=>:indexexpire_action似乎只是在没有任何参数的情况下使索引操作过期。如何使与索引相关的所有caches_action过期?(这是一个Rails2.3.5应用程序) 最佳答案 如果你没有使用memcached,你可以使用带正则表达式的expire_fragment:expire_fragment(Regexp.new("/yourpath/y

ruby-on-rails - 消息 : Failure/Error: require File. expand_path ('../../config/environment' , __FILE__)

首先,我阅读了其他有类似问题的用户的帖子,但无法找出我的错误所在。我想在以下文件上使用RSpec开始测试:dashboard_view_spec.rb:require'rails_helper'RSpec.feature"Dashboard",type::featuredobefore(:each)do@current_user=User.create!(email:"xyz@xyz.com",password:"xyz123")sign_in_with(@current_user.email,@current_user.password)end#NAVBARRSPECTESTscen