Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails未定义的方法`图形存储';对于图形:模块_Ruby On Rails_Ruby - Fatal编程技术网

Ruby on rails Rails未定义的方法`图形存储';对于图形:模块

Ruby on rails Rails未定义的方法`图形存储';对于图形:模块,ruby-on-rails,ruby,Ruby On Rails,Ruby,我有三个文件,两个类文件和一个模块文件,模块包含从其他文件继承的类,这样你就可以“需要”图形,但它不起作用 模块的代码为 require 'gstore' require 'grender' require 'chunky_png' module Graphic class Graphic_Store < GStore end class Graphic_Render < GRender end end 需要“gstore” 需要“grender” 需

我有三个文件,两个类文件和一个模块文件,模块包含从其他文件继承的类,这样你就可以“需要”图形,但它不起作用

模块的代码为

require 'gstore'
require 'grender'
require 'chunky_png'
module Graphic

   class Graphic_Store < GStore
   end

   class Graphic_Render < GRender
   end

end
需要“gstore”
需要“grender”
需要“chunky_png”
模块图形
类图形存储
我不确定您是否应该这样使用它,但我在浏览器中遇到了未定义的方法错误。 无论我在控制器中执行“Graphic_Store”还是Graphic::Graphic_Store”,我都会得到相同的错误,唯一的区别是,在第二个错误中,它在图形文件而不是控制器上出错

我这样做的唯一原因是因为它以任何方式对它们说“undefined method”,至少这样它在一个文件上,它给了我一个名称空间


当我把要求放在其他文件中时,我还不断地得到“无法加载文件-chunky_png”。执行“gems”显示安装了chunky_png gem。

我可以通过删除模块并将两个类嵌套在一个名为Graphic的类中来让它工作