Sencha Architect生成的布局无法集成到Ruby on Rails项目中

时间:2022-02-21 20:42:50

I'm actually working in a Ruby on Rails Project and I've created a simple layout with Sencha Architect and the files Sencha Architect generates are: Sencha Architect生成的布局无法集成到Ruby on Rails项目中

我实际上在Ruby on Rails项目中工作,我用Sencha Architect创建了一个简单的布局,Sencha Architect生成的文件是:

and Inside of app folder :

和app文件夹内:

Sencha Architect生成的布局无法集成到Ruby on Rails项目中

So I have in my Ruby on Rails project this code for the layout, in te lines 15 and 16 I have already referred to the files that were generated by sencha architect

所以我在Ruby on Rails项目中有这个代码用于布局,在第15行和第16行我已经提到了sencha架构师生成的文件

Sencha Architect生成的布局无法集成到Ruby on Rails项目中

And when I run the project the browser console displays this error:

当我运行项目时,浏览器控制台会显示以下错误:

Sencha Architect生成的布局无法集成到Ruby on Rails项目中

it can't find the app/view/MainView.js wich indeed is in that rout. Can someone help me?

它找不到app / view / MainView.js确实在那个溃败中。有人能帮我吗?

1 个解决方案

#1


0  

Javascript needs to go in app/assets/javascripts. Just placing the file in app/view doesn't make it available at that "route", this is not how Rails works. You're working with an application, not a static web site serving up all the files in the various directories.

Javascript需要进入app / assets / javascripts。只是将文件放在app / view中并不能使它在“路由”上可用,这不是Rails的工作方式。您正在使用应用程序,而不是提供各种目录中所有文件的静态Web站点。

Look into Rails Routing, and the Asset Pipeline for more information.

查看Rails Routing和Asset Pipeline以获取更多信息。

If you put MainView.js into app/assets/javascripts, you can include it in the application.js file, like the other files that are likely there, or if not, like this:

如果您将MainView.js放入app / assets / javascripts,您可以将它包含在application.js文件中,就像其他可能存在的文件一样,如果没有,就像这样:

//= require ./MainView     # brings in this one file

or

要么

//= require_directory .    # brings in all javascripts in the directory

And now when you bring in the application javascript, your MainView content will also be included.

现在,当您引入应用程序javascript时,您的MainView内容也将被包含在内。

#1


0  

Javascript needs to go in app/assets/javascripts. Just placing the file in app/view doesn't make it available at that "route", this is not how Rails works. You're working with an application, not a static web site serving up all the files in the various directories.

Javascript需要进入app / assets / javascripts。只是将文件放在app / view中并不能使它在“路由”上可用,这不是Rails的工作方式。您正在使用应用程序,而不是提供各种目录中所有文件的静态Web站点。

Look into Rails Routing, and the Asset Pipeline for more information.

查看Rails Routing和Asset Pipeline以获取更多信息。

If you put MainView.js into app/assets/javascripts, you can include it in the application.js file, like the other files that are likely there, or if not, like this:

如果您将MainView.js放入app / assets / javascripts,您可以将它包含在application.js文件中,就像其他可能存在的文件一样,如果没有,就像这样:

//= require ./MainView     # brings in this one file

or

要么

//= require_directory .    # brings in all javascripts in the directory

And now when you bring in the application javascript, your MainView content will also be included.

现在,当您引入应用程序javascript时,您的MainView内容也将被包含在内。