Heavenly’s new Flatpack CMS going to be a Rails 2 project which means I get to play with some new features! There have been quite a few changes to the standard rails way of making applications.
There’s a new rake task: rake db:create:all which generates your databases from your yml file. Slightly easier than using yog or similar to do the same job.
The scaffolding system has also changed. In Rails 1 I would generally generate a model, edit the migration, run it and then generate the scaffold to make the views and controller. This doesn’t work in Rails 2 as the generator stops if the migration already exists, the views are created but the controller is not. I have a feeling this may get changed in future versions. Instead we use the extended version of the scaffold. Typing: ruby script\generate scaffold Page title:string text:text permalink:string now builds the entire page model, views, controller, and migration script in one fell swoop.
The list view is no longer generated by the scaffold. Instead, the index template now does everything the old list template used to. This make a whole lot of sense to me.
Templates now use the erb suffix which initially confused my editor. As far as I can tell, the two file types are functionally the same, in fact rhtml was always erb by another name.
Rather wonderfully Ajax support now comes as standard in scaffolded templates as the respond_to block is now autogenerated. This block lets you respond to requests depending on the http request eader submitted by the client. Tell it to respond to a js request and it’ll deal with it nicely. This makes me extremely happy as Flatpack is heavily ajaxified.
I’ll post further information as I find it.