简体   繁体   English

如何在Rails和angularjs上的ruby中编写路径重定向

[英]How to write path redirect in ruby on rails and angularjs

Sorry that I am new to ruby on rails. 对不起,我是刚接触红宝石的人。

I am trying to create a directive in angularjs. 我正在尝试在angularjs中创建指令。 What I was doing is create an html file in folder view/forms, named topRight-buttonGroup.html 我正在做的是在文件夹视图/表单中创建一个名为topRight-buttonGroup.html的html文件。

Then I just created a simple directive for test: 然后,我创建了一个简单的指令进行测试:

app.directive('topRightButtonTools', function(){
    return {
        restrict: 'C',
        templateUrl: 'topRight-buttonGroup.html'
    };
});

But getting the error message in the console is: 但是在控制台中收到错误消息是:

GET http://localhost:3000/forms/topRight-buttonGroup.html 404 (Not Found) 

Am I missing something should be done on ruby on rails? 我是否错过了应该在轨道上的红宝石上做些什么? Or should I write some redirect code and save in somewhere? 还是应该编写一些重定向代码并保存在某个地方?

my full folder structure is: 我的完整文件夹结构是:

这是我的结构

If you need the form to be accessible so, create a folder inside public / as forms / and have the file placed there. 如果您需要可访问的表单,请在public /内创建一个文件夹作为forms ,并将文件放置在该文件夹中。 Only content inside the public dir are rendered directly. 仅公共目录中的内容直接呈现。

Unlike core php or other such scripting languages, RoR requires controllers to render actions which arent merely files that are interpreted. 与核心php或其他此类脚本语言不同,RoR需要控制器来呈现仅解释文件的操作。 Also, routes are to be defined in config/routes.rb. 另外,路由将在config / routes.rb中定义。

Refer: 参考:

http://guides.rubyonrails.org/routing.html http://guides.rubyonrails.org/routing.html

http://www.xyzpub.com/en/ruby-on-rails/3.2/statische_webseiten.html http://www.xyzpub.com/en/ruby-on-rails/3.2/statische_webseiten.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM