Finally after I was hidden for a while it’s time to announce what was keeping me busy, it’s not really a huge thing but it is a new idea that came to my mind and I thought maybe it’s time to implement and announce it. As you can tell from the title it is related to Ruby on Rails and it is a tutorial.
Rails Project Story is a weekly tutorial series that tells the life of a simple Rails project, starting from the planning and database design until the end of testing and packaging.
Book Swap
The chosen project for this tutorial will be Book Swap; a simple web application based on users and book lovers, it will allow them to create their own bookshelf and swap books between each others. I chose Book Swap for this tutorial for two main reasons:
- The simplicity of the idea, it has most of the regular features that almost every regular web application has like multilevel user system, tagging and a moderate database complexity with enough relations variety.
- The idea is not new, there is already a live implementation of it called BookMooch so I’m not trying to come with something new nor to compete or steal the idea, all what I’m trying to do is to give a quick tutorial on how we can do a similar approach quickly and efficiently in Rails; doing my best to demonstrate the benefits any developer can get from such a wonderful framework.
Background and Credit
The idea of this project was never mine; I have read about it almost a year back on my friend’s blog (Abdullah Al Muhairi aka. Serdal) where we have discussed it a little further, since then I really wanted to do it, I even started a RubyForge project for it that shamefully I never committed anything to it.
I want to thank Abdullah for the idea and as I’m ashamed not to start the idea when I had to due to nothing but laziness I decided to make it into something more usefull for myself and for everybody by converting it into this tutorial.
Quick Start
As a start let’s try to identify the basic steps we will follow in our process, I tried to follow the most up-to-date methodologies and technique in the process of this project, most of those I normally practice in my projects while some are a bit new for me so writing this tutorial will help me practice them more too.
Why this tutorial is better?
Simply: It is not, this tutorial is no better than any of the available tutorials but it is “different“, this tutorial may not give you anything new or more than what’s in other tutorials; instead it’s written as a live record of a regular web application to document the required steps and techniques during the making process.
In my planning for this tutorial I wrote down the ideas I’m willing to cover, this is what I have in mind so far, for sure this list and its items order will be updated according to the requirements of the application in the live process but at least it can give you an idea on the steps we will follow:
- Getting Started: In this part we have met Rails in a little depth, had a quick look at the file structure it generates and understood some of the migrations and schema magic as well, technically we have now a basic rails application for books where we can add, edit and delete any record at any time after we wrote a very minimum amount of code and left the rest on Rails to take care of.
- User Authentication: In this part we have implemented the Acts As Authenticated plugin into our application, modified it a little and understood few backend behaviors specifically the way the view templates handle ERb code, we also had a better look at the migration process and understood how they help us have a better control over our database modifications in a very dynamic way.
- Interface design and scaffolding
- Dealing with Files
- Plugins
- Web Services and Restful Thinking
- Handling Errors and Exceptions
- Testing
- Refactoring
- User Interface Revisited (Ajax/RJS)
- Packaging and Production
Development Environment
I will not cover any development environment setup in this tutorial so depending on what’s your operating system you can find out some good tutorials out there that will help you out setup your development environment correctly and here are some:
- Mac users: The Hivelogic Narrative: Building Ruby, Rails, LightTPD, and MySQL on Tiger
- Windows users: I tried my best on this: Ruby, Rails, Mongrel, FastCGI, Apache2 and Typo on Windows
- Linux users: From Rails official Wiki: Fedora, FreeBSD, Redhat9 and Ubuntu
I’m still working on preparing an open subversion repository (most probably I will use RubyForge) to host the application code and I will version it as per the parts we are doing together here.
As I mentioned this is a weekly series and I chose Saturday to be the day where parts will come up every week, I will update this post after each part is published to add a link or modify the list items accordingly.
So.. Stay tuned for the first part next Saturday.
Disclaimer
I just want to clarify that this tutroial is simply how I as Rida Al Barazi do my projects on Rails so I’m not saying this is the only way or even the best way to do things, it is only MY way and I hope you will like it.
Abdelrahman Osama said..
That’s great Rida but I’d like to ask is this tutorial for some one like me who don’t have any previous background of web development in general and in ROR in specific or it’s for developers who have at least a background of development ?
I suggest also you make sure your readers get the framework up and running on there systems weather it’s Windows or Mac OS by posting about how to setup the framework or referring to other posts who explains it.
Thanks for sacrificing your time for others I really appreciate it.
on August 16th at 9:03 amRida said..
Thanks Abdelrahman for bringing this up, actually this tutorial require a minimum of programming and development background, it will be perfect if you have a previous experience in web development in some other languages and it may work if you have some programming background but if you don’t have any of those I’m afraid this tutorial won’t help you.
As of the framework setup; I will refer as you mentioned to some earlier posts on my website for Windows users and to some other resources for Mac users as I won’t go in any details on the setup part in order to give more space to the project development process instead of the web server administration
on August 16th at 11:59 amRida Al Barazi » Blog Archive » Rails Project Story: 1. Getting Started said..
[…] So here is the first part of the previously announced Rails Project Story, in this part we are going to understand the Rails directory structure, design a very basic database to start with, link it to our rails application, setup the rails database schema for it and finally try the famous scaffolding feature that everybody talks about. […]
on August 20th at 8:05 pmRida Al Barazi » Blog Archive » Rails Project Story: 2. User Authentication said..
[…] Here comes the second part of our story, last time in part one we met rails directory structure, designed a three tables database, created it in MySQL and linked it to our application then we let rails db schema create those tables for us and finally we generated a modest scaffold for our Books table. […]
on August 28th at 6:05 amMatthewVB said..
Rida,
I’m enjoying your tutorial — it’s very thorough. I was wondering when the next part will come out?
Thanks!
on November 1st at 5:51 am-matthewvb
Rida said..
@matthewvb, I’m really glad you are enjoying the tutorial, you are right and I admit that I’m quit late in writing the next part or even writing new posts..
All I can say is that I’m working on it, and hopefully this week something new will show up.
Welcome to ridaalbarazi.com ;)
on November 1st at 5:58 ammatthewvb » Blog Archive » acts_as_authenticated in ruby said..
[…] Right now I’m working off Rida Al Barazi’s Rails Tutorial to get started. It’s a work in process, but I’m still looking for the more indepth look at integrating roles and levels. […]
on November 1st at 7:22 amMatthewVB said..
Rida,
Do you have the source code available for the tutorials you’ve presented? I’d be interested in trouble-shooting my problems that ways if you’d be willing to make them available.
Thanks,
on November 8th at 10:11 pm-matthewvb
Rida said..
MatthewVB,
Yes it is available, it will be available on RubyForge after each chapter starting from next chapter (coming next Sunday).
on November 9th at 11:35 amMatthewVB said..
Great to hear Rida! Looking forward to the next installment!
on November 9th at 6:47 pm