Making a custom plugin/gem/engine for Rails 3 app
I am foll开发者_Python百科owing 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!
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
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:
rails plugin new your-gem-name --full
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 an engine
. For more options (e.g. --mountable
check the documentation).
I recommend you have a look here:
https://github.com/krschacht/rails_3_engine_demo
Or the more famous:
https://github.com/josevalim/enginex
精彩评论