[英]Using image_tag inside rails engine
当image_tag("cheese.png")
位于assets/images/my_engine/cheese.png
时,为什么不将其加载到我的视图中(在my_engine
)?
@Simrayz - I'd need to see more of your directory structure to fully understand, but in general the image pathing in rails isn't dependent on your view structure. @Simrayz-我需要查看更多目录结构才能完全理解,但是通常,rails中的图像路径并不取决于您的视图结构。 It's dependent on the assets image directory structure. 它取决于资产映像目录结构。
So if you have assets/images/my_engine/cheese.png you can access it with the path my_engine/cheese.png from any view, regardless of the directory structure of your view files. 因此,如果您拥有asset / images / my_engine / cheese.png,则无论视图文件的目录结构如何,都可以在任何视图中使用路径my_engine / cheese.png访问它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.