Ruby on Rails? .. yes, I started to learn Ruby on Rails (abbr as ROR)!
It's quite a challenge and honestly it's not the first attempt.
but .. the water is not that cold after all :D
So why taking this challenge?
Well.. Ruby is a strong and sexy OOP language and Rails embeds the MVC architecture
When dealing with more complex projects a MVC approach is inevitable
MVC stands for Model-View-Controller and allows your web app to be structured in a more logical way:
-the model handles the data (database)
-the controllers the application logic
-the views the presentation logic
Some advantages of MVC are scalability, easier maintenance and re-use of code. When using it for a while I will expand on this ..
A good intro on ruby on rails and the MVC architecture -which surprisingly enough has been around for over 30 years!- can be found here. Build your own ruby on rails web applications, by the same author, is a good intro. I started to read it this weekend, although terribly busy, I am one third through, because it is accessible and to-the-point.
You need to take several steps to get ROR up and running on your system, depending the OS you are running.
Basically you need to:
- install rails
- install rubygems*
- install rails via gem
- install mysql
- install ri (optional; documentation)
* this is the name of the app. When installed, you run $ gem .. from the command line interface (aka terminal).
It a ruby app or package manager, compare it to "port" on the Mac or "apt-get" on Ubuntu.
I had some compatibility issues between the various apps on Linux and Mac (mainly Mysql config).
I found some useful links I want to share:
- Ubuntu: all errors could be found + solved here: http://rbjl.net/20-rubybuntu-2-troubleshooting-common-ruby-ubuntu-problems
- Mac: comes with ruby + rails, less work here. You might have an issue with Mysql when starting your freshly created webapp: in your terminal where you start the app with "ruby script/server" you see uninitialized constant MysqlCompat::MysqlRes and a lot of spam after that. Installing Mysql via "gem" with the following flags helped - thanks to this tip
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Just some observations from a guy stubbing his toe in the swimming pool :D
[caption id="attachment_114" align="aligncenter" width="600" caption="installed ruby on rails on mac and ubuntu"][/caption]
Prepare for next months..
The links below are far better in explaining the installation process and first steps with ROR
In the (near) future I'd like to dedicate 3 posts to:
1- the ruby programming language
PHP is fun, it's powerful, it's comfortable, somebody I can laugh and cry with, but it has its limitations and OOP was put on top of it.
Ruby is natively OOP, it's compact and it seems very smart and in conjunction with rails it's very powerful.
2- the rails framework
More on MVC and its practical implications doing web development.
3- my first rails app
.. if you're interested just follow the "New blog post" notices @bbelderbos
So you also want to ride Ruby on Rails ?
Here are some useful links:
- ROR homepag: http://rubyonrails.org/
- ROR guides: http://guides.rubyonrails.org/
- ROR on twitter: http://twitter.com/rails
- ROR linkedin: http://www.linkedin.com/groups?home=&gid=22413
- ROR beginner's guide: http://articles.sitepoint.com/article/learn-ruby-on-rails
- Book Patrick Lenz: http://www.amazon.com/Build-Your-Ruby-Rails-Applications/dp/0975841955
- ROR tuts sitepoint: http://articles.sitepoint.com/category/ruby
- Top 12 ROR Tutorials: http://www.digitalmediaminute.com/article/1816/top-ruby-on-rails-tutorials
- Install ROR on