我不是Rails或Rspec的新手,但我是制作宝石的新手.当我测试我的控制器时,REST方法"get","post","put","delete"给我一个未定义的方法错误.
您可以在下面找到代码,但如果您希望在贴图中看到它,请单击此处.
谢谢!
这是我的spec_helper:
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rubygems'
require 'active_support' unless defined? ActiveSupport # Need this so that mattr_accessor will work in Subscriber module
require 'active_record/acts/subscribable'
require 'active_record/acts/subscriber'
require 'action_view'
require 'action_controller' # Since we'll be testing subscriptions controller
#require 'action_controller/test_process'
require 'spec'
require 'spec/autorun'
# Need active_support to user mattr_accessor in Subscriber module, and to set the following inflection
ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'dorkus', 'dorkuses'
end
require 'active_record' # Since we'll be testing a User …Run Code Online (Sandbox Code Playgroud) 我遇到了为ruby 1.9.2安装linecache19(ruby-debug19的依赖项)的问题
这是我的术语输出
$ rvm use 1.9.2
Using /home/bogdan/.rvm/gems/ruby-1.9.2-p180
$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
$ rvm exec gem install linecache19 --backtrace
gem install linecache19 --backtrace
rvm 1.6.20 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]
ERROR: Error installing linecache19:
linecache19 requires Ruby version >= 1.9.2.
ERROR: Error installing linecache19:
linecache19 requires Ruby version >= 1.9.2.
Building native extensions. This could take a while...
Run Code Online (Sandbox Code Playgroud)
最后一个命令永远挂起,直到被^ C中断.
任何想法如何解决?
我正在创建一个新项目:
rails new ggg --database=mysql
Run Code Online (Sandbox Code Playgroud)
并得到以下输出:
create
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/mailers
create app/models
create app/views/layouts/application.html.erb
create app/mailers/.gitkeep
create app/models/.gitkeep
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create …Run Code Online (Sandbox Code Playgroud) 可能重复:
Rails 3.1和Ruby 1.9.3p125:ruby-debug19仍然崩溃"未找到符号:_ruby_threadptr_data_type"
我运行这个:
gem install ruby-debug19
在我的黄瓜env.rb文件中,我有这个:
require 'ruby-debug'
但是,当我尝试运行时,我得到了这个例外:
/home/skendall/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_current_thread - /home/skendall/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so (LoadError)
我需要做些什么才能让ruby-debug与1.9.3-p0一起使用?
这似乎不是一件难事.
我想要一个ruby脚本来确定系统上当前是否安装了某个gem(任何版本和/或某个版本规范)(无论在哪里gem list看),如果没有,请安装它.
是的,我知道在某些情况下,捆绑包很棒.相信我有一个案例,出于奇怪的原因,我不想使用bundler.我真的想以编程方式询问本地gem repo.
一种可编程安装的方法就是gem install确保安全.
但我无法找到一种可靠的方法来以编程方式询问是否安装了特定的gem,而不是shell,而不是rubygem api,而不是任何东西.
我错过了吗?
我有一个我要重命名的宝石.它发布在RubyGems上.我最担心的是人们想要更新它.
我看到两条路,但是真的想听听那些重命名他们的宝石的人,他们是怎么做到的.
smart-cropper)smart-cropper为croptoelie(旧宝石)的依赖croptoelie我看到的一个问题是,它太透明了,人们可能不会意识到他们使用的宝石不再被维护.
另一个问题是版本控制变得更难:每次我发布一个新版本的renamed(smart-cropper)gem时,我都必须碰到旧版"metapackage"的版本,否则人们永远不会得到新版本.
我可以发送一个旧宝石的版本,只是抛出弃用警告,并发出一条消息,人们应该安装新的宝石.
我看到的问题是它可能非常具有侵入性,可能会让人们[1]完全脱离宝石.
还有其他选择吗?"RubyGems"中是否有内容可以满足更改名称的需要?
[1]并不是说有太多人在使用它; 因为这个名字很难找到.:)
看起来这两个宝石都执行非常相似的任务.任何人都可以举例说明一个宝石比另一宝石更有用吗?我没有具体的代码,我更想知道每个gem的一般用例.我知道这是一个简短的问题,我会根据要求填写空白.谢谢.
我安装了ruby并更新了ruby gem,现在我想下载rails 3.2.13.我写gem安装rails -v 3.2.13(我需要这个版本)我有这个错误
ERROR: Could not find a valid gem 'rails' (= 3.2.13), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect SYSCA
LL returned=5 errno=0 state=SSLv2/v3 read server hello A (https://rubygems.org/s
pecs.4.8.gz)
ERROR: Possible alternatives: rails
Run Code Online (Sandbox Code Playgroud)
我在互联网上看到可能下载gem httpclient它可以工作,但我没有设法下载它(另一个错误)你知道我怎么能解决这个问题吗?
试图在Debian/Ubuntu上安装ruby-odbc gem会导致以下错误;
"ERROR: sql.h not found"
为什么zsh: command not found: bundle之后gem install bundler?
我试着设置path=( /usr/local/lib/ruby/gems/2.2/gems/ ~/bin /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin )中/etc/zshrc并source /etc/zshrc没有用.
root@dev:/home/dev# gem install bundler
Successfully installed bundler-1.7.12
Parsing documentation for bundler-1.7.12
Done installing documentation for bundler after 10 seconds
1 gem installed
root@dev:/home/dev# bundle
zsh: command not found: bundle
root@dev:/home/dev# uname -a
OpenBSD dev.my.domain 5.7 GENERIC#748 amd64
root@dev:/home/dev# gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5
- RUBY VERSION: 2.2.0 (2014-12-25 patchlevel …Run Code Online (Sandbox Code Playgroud)