Html 如何使用命名空间路由使用自定义文件夹资产?
我正在尝试使用创建的模板并将其应用到RubyonRails项目中,而无需添加资产或使用RubyonRails过程 是否可以在命名空间路由上使用自定义文件夹 当我执行项目时,如果不使用名称空间,它就无法工作,但是当我使用资源时,它工作得非常好 示例:Html 如何使用命名空间路由使用自定义文件夹资产?,html,ruby-on-rails,ruby,asset-pipeline,assets,Html,Ruby On Rails,Ruby,Asset Pipeline,Assets,我正在尝试使用创建的模板并将其应用到RubyonRails项目中,而无需添加资产或使用RubyonRails过程 是否可以在命名空间路由上使用自定义文件夹 当我执行项目时,如果不使用名称空间,它就无法工作,但是当我使用资源时,它工作得非常好 示例: user_management/users/index.html.erb works ok. user_management/users/new.html.erb doesn't load assets. user_management/users
user_management/users/index.html.erb works ok.
user_management/users/new.html.erb doesn't load assets.
user_management/users/new.html.erb doesn't load assets.
users/index.html.erb works ok.
users/ new.html.erb works ok.
users/edit.html.erb works ok.
Github项目代码:
https://github.com/sayayingod/app_sow
application.rb
Dir.glob("#{Rails.root}/color_admin_v4.5/assets/").each do |path|
config.assets.paths << path
end
用户管理/users/new.html
users/new.html.erb
到处都有这样的相对路径:
,请使用绝对路径:
另外,使用rails帮助程序,如
javascript\u include\u tag
,样式表\u link\u tag
,图像\u tag
,等等,不要硬编码标签,你会有更少的headhaches。你到处都有这样的相对路径:
,而是使用绝对路径:
。另外,使用rails帮助工具:javascript\u include\u tag
,样式表\u link\u tag
,图像\u tag
,等等,不要硬编码标签,你会有更少的headhachesOMG。。。5年前我一直在寻找答案。最后我找到了一个英雄。@arieljuod你想发布最终答案吗?我会接受的
namespace :user_management do
resources :users
end
resources :users
#Root Configuration
root 'user_management/users#new'