Monday, June 7, 2010

Rails 3 Deep Dive - part 2


Rails 3 uses Railties to integrate your plugin/gem more cleanly. Having your plugins be gems is a goal.


Lots of configuration possibilities. There is now much more fine-grained support for hooks into the Rails startup process. You now inherit from Rails::Engine to initiate the integration.

Jeremy adds a small sample engine very quickly. Interestingly he appears to be running on Rails 3 on ruby 1.9.2-head - a vote of confidence in the recently attained support.


Now generators have simpler syntax but all the public methods are generator tasks, so make other code private.

Thor is behind the generators and has a lot of built-in support for file system and other operations.

It is easy to configure the components which you want to be used with your custom generators:

view template - say :haml
test framework - say :rspec
fixture replacement - say :factory_girl

The generators use this configuration to create appropriate files (e.g. unit tests with the correct testing framework when a new model is generated).

No comments: