在Ruby on Rails中创建动态页面

时间:2021-07-12 02:15:41

What's the best solution to creating dynamic pages in Rails? I'm working on a simple admin interface where I want to be able to create pages of content and have them dynamically added to the site without having to have them added to the controller.

在Rails中创建动态页面的最佳解决方案是什么?我正在开发一个简单的管理界面,在这个界面中,我希望能够创建内容页面,并将它们动态地添加到站点中,而不需要将它们添加到控制器中。

Ie, don't want to do this in pages controller.

不要在页面控制器中这样做。

def about
...
end

def privacy
...
end

I was thinking of doing something like have all pages use the show action which looks at url by permalink and fetches that from the database although I'm not sure the best approach to doing this. Any feedback on this would be great.

我想做一些事情,比如让所有页面都使用show操作,它通过permalink查看url并从数据库中获取url尽管我不确定最好的方法。对此的任何反馈都是非常好的。

2 个解决方案

#1


4  

I think this is exactly what you need: Railscast - Semi-Static Pages

我想这正是您所需要的:Railscast -半静态页面

#2


0  

You can use High Voltage gem.

你可以使用高压宝石。

#1


4  

I think this is exactly what you need: Railscast - Semi-Static Pages

我想这正是您所需要的:Railscast -半静态页面

#2


0  

You can use High Voltage gem.

你可以使用高压宝石。