在 Rails 上使用 Ruby 中的 gem 似乎不起作用
Using a gem in Ruby on Rails does not seem to work
我已经安装了 gem ruby-imagespec
代码如下所示:
class TestController < ApplicationController
def ratio(fid)
file = File.new("#{Rails.public_path}/test/#{fid}.swf", "rb")
dimensions = ImageSpec.new(file)
return dimensions
end
helper_method :ratio
end
当我尝试 运行 时出现错误:
"uninitialized constant TestController::ImageSpec" on line 7 The
gem is listed in the gemfile and explicitly requiring it does not
work.
哪里出错了? gem 已正确安装,此代码与 gem 的 README
中的代码一样
ruby-imagespec 不受支持gem,请尝试 fastimage:
在你的 Gemfile 中添加 gem 'fastimage'
查看 the ruby-imagespec repository,您需要的文件似乎是 lib/image_spec.rb。试试 require 'image_spec'
.
我已经安装了 gem ruby-imagespec
代码如下所示:
class TestController < ApplicationController
def ratio(fid)
file = File.new("#{Rails.public_path}/test/#{fid}.swf", "rb")
dimensions = ImageSpec.new(file)
return dimensions
end
helper_method :ratio
end
当我尝试 运行 时出现错误:
"uninitialized constant TestController::ImageSpec" on line 7 The gem is listed in the gemfile and explicitly requiring it does not work.
哪里出错了? gem 已正确安装,此代码与 gem 的 README
中的代码一样ruby-imagespec 不受支持gem,请尝试 fastimage:
在你的 Gemfile 中添加 gem 'fastimage'
查看 the ruby-imagespec repository,您需要的文件似乎是 lib/image_spec.rb。试试 require 'image_spec'
.