↓ Archives ↓

Posts Tagged → generator

How to Install and Use Rails 3 Generators

This is why Rails3's philosophy is agnosticism:

You can override default template engine (erb) through config/application.rb. So if you use HAML, running scaffold generator will create HAML files for the views. If you use Rspec for testing as most Ruby developers do, you may also specify rspec as the default test framework.

#Configure generators values. Many other options are available, be sure to check the documentation.
config.generators do |g|
  g.template_engine :haml
  g.test_framework :rspec, :fixture => true, :views => false
end

I think the right repository for the Rails 3 generators is the one maintained by Andre Arko of Engine Yard.

cd yourapp
git clone git://github.com/indirect/rails3-generators.git lib/generators

Blog app basics:

script/rails generate scaffold post title:string body:text published:boolean 

This post by Katz Pe is from BridgeUtopia.