Ruby on Rails 有类似 Grails taglibs 的东西吗?
我有几个月的 Ruby on Rails 经验,从一开始就非常喜欢它。现在,为了工作,我被要求用 Grails 编写代码,尽管我一开始有一些反对意见,但我现在认为这是一个非常不错的框架。
Grails 中真正让我印象深刻的一件事是 Taglib,因为它们使前端模块化变得更加容易。
我真的很想用 Rails 做点什么。
- 有没有类似 Taglibs for Rails 的东西?
- 如果不是,那么实现这种视图模块化的最佳实践是什么(本质上,让我的生活更轻松)?
I have a few months of experience with Ruby on Rails and really loved it from the beginning on. Now, for work, I was asked to code in Grails and although I first had some objections, I now think it's a very decent framework.
One thing that really impressed me in Grails are Taglibs because they make frontend modularity so much easier.
I would really like to do something with Rails.
- Is there anything like Taglibs for Rails?
- If not, what are the best practices for accomplishing this kind of view modularity (and, in essence, making my life easier)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以构建自己的助手,并且视图可以访问这些助手。以 formtastic 为例,它提供了额外的方法/标签来构建表单。
严格来说,formtastic 是一个 Rails 插件,但它遵循相同的原理。
You can build your own helpers and the views can access those helpers. Take as an example formtastic, which provides extra methods/tags to build forms.
Strictly speaking, formtastic is a rails plugin, but it follows the same principles.