Build your RESTful Weblog in RoR in 30 minutes


The First Rails 2.0 Screencast from akitaonrails on Vimeo.

Remember that original “Building a Blog in Ruby on Rails in 15 minutes” screencast that captured the whole emerging RoR community (myself included) ??? The very one that got me started in Rails…sweet memories !!!!

Here’s another one, but is created in Rails 2.0, and it is RESTful!!!! Apparently it is also the first one for Rails 2.0.

I quickly skimmed through the video, and I thought it was awesome. It covered the basics of Rails 2.0, from your scaffolding to your Models, and then all the way to custom named routes and creating a custom interface for your iPhone !!!!!

Hope you enjoy it.

Share/Save/Bookmark

Scaffolding Rails 2.0 Style

Amidst all the recent non-technical work that I have been doing, I have managed to plug myself back to the wonderful world of Ruby on Rails.  I have written a number of posts regarding my experience with Rails 1.0 before in my blogs. Having made a recent decision to focus my engineering skills in Rails 2.0, I thought it would be a good time to continue that Rails 1.0 legacy that I left off. 


The first thing that caught me while doing Rails 2.0 was Scaffolding. Being as lazy as I am when it comes to programming, I loved scaffolding to bits in Rails 1.0. I like the idea of being provided with scaffolds and build the software inside out. 
I was surprised when my usual

?>script/generate scaffold model_name controller_name actions
did not work. It turned out that the new way to do scaffolding in Rails 2.0 is the following way :-
?>script/generate scaffold modelName field_name:field_type
It’s that simple!
For example, ?>script/generate scaffold User name:string role:string will generate a User model with the attribute of Name and Role in it. The screen shot below shows the physical database model created after migration ( ?>db:migrate) is done. It’s filled with stub data created with the scaffolded interface.
That single line of command generates the usual CRUD operations associated with the model. Furthermore, scaffolding also creates the usual methods in the controller that responds to both conventional + REST style information access!!! For instance, the below screenshot shows the XML returned when I did a /users/1.xml in Firefox.
I will be playing more and more with Rails 2.0 in the coming days.
Stay tuned!!!

Share/Save/Bookmark