使用 ruby​​ on rails 向静态网站添加功能 [英] Adding functionality to a static website using ruby on rails

查看:41
本文介绍了使用 ruby​​ on rails 向静态网站添加功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 ruby​​ on rails 的新手.

I am new to ruby on rails.

我有一个包含大量静态页面的网站.我想向网站添加一些动态页面,我将在 ruby​​ on rails 中开发这些页面.当用户单击静态页面之一上的按钮之一时,将触发这些页面提供的功能.我想我会将动态页面放在一个目录中,当单击静态页面之一上的按钮时,其中一个将被调用(执行).我不需要更改现有静态页面的内容.

I have a website with a lot of static pages. I want to add a number of dynamic pages to the website and these I am going to develop in ruby on rails. The functionality offered by these pages will be triggered when the user clicks on one of the buttons which is on one of the static pages. I am thinking that I will put the dynamic pages in a directory and one of them will be called(executed) when the button, which is on one of the static pages, is clicked. I do not need to change the content of existing static pages.

是否可以将此类动态页面添加到现有静态网站中?如果是,如何?我需要改变路线吗?

Is it possible to add such dynamic pages to existing static website? If yes, how? Do I need to change routes?

推荐答案

你必须反过来做 - 将你的静态页面放到你的 rails 应用程序的public"文件夹中 - 如果一个由 url 标识的文件存在,rails将提供这些文件,如果文件不存在,rails 将尝试找到合适的控制器/动作...

you have to do it the other way round - put your static pages into your rails applications 'public' folder - if a file identified by an url exists, rails will serve these file, if no file exists, rails will try to find a suitable controller/action ...

这篇关于使用 ruby​​ on rails 向静态网站添加功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆