为 Rails 3 应用程序制作自定义插件/gem/引擎
我正在遵循指南 http://edgeguides.rubyonrails.org/plugins.html ,看起来有点过时了。您能看一下并告诉我哪些部分应该在 Rails 3 中以不同的方式完成吗?
EDIT1:也非常欢迎替代教程的链接!
I am following the guide http://edgeguides.rubyonrails.org/plugins.html and it seems to be slightly outdated. Could you have a look on it and tell me which sections should be done in a different way in Rails 3?
EDIT1: Links to alternative tutorials are also very welcome!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议你看看这里:
https://github.com/krschacht/rails_3_engine_demo
或者更有名的:
https://github.com/josevalim/enginex
I recommend you have a look here:
https://github.com/krschacht/rails_3_engine_demo
Or the more famous:
https://github.com/josevalim/enginex
你是对的,该指南并不是最好的(最后一次更新日志条目是 2010 年 4 月)。
相反,我建议您阅读: https://github.com/雷达/guides/blob/master/gem-development.md
You're right, that guide isn't the best (the last changelog entry is April 2010).
Instead, I'd recommend you read: https://github.com/radar/guides/blob/master/gem-development.md
我遇到了这个问题,答案现在已经过时了。 Railsguide 目前是最新的:http://guides.rubyonrails.org/engines.html
enginex
gem 已集成到 Rails 中,创建引擎现在非常简单:与
rails new
命令非常相似,这将创建一个新文件夹,其中包含一个空白gem 供您填写。此 gem 自动成为一个引擎
。有关更多选项(例如--mountable
检查文档)。I bumped into this question, and the answers are now outdated. The railsguide is currently up to date: http://guides.rubyonrails.org/engines.html
The
enginex
gem has been integrated into rails, and creating an engine is now as simple as:Much like the
rails new
command, this will create a new folder, containing a blank gem for you to fill in. This gem is automatically anengine
. For more options (e.g.--mountable
check the documentation).