Hello.
The other day, I recalled seeing a blog post about Ruby on Rails and one of the tech movies from the Rails site ([url]
http://www.rubyonrails.org)[/url].
The movie in question showed how you could, in theory, have a very basic blogging system up and running in under an hour using Rails.
I had a basic idea of what Rails was and the movie was quite interesting, so I thought I'd try it out myself since I had been promised a nice and powerful language before, but had been dissapointed by poor syntax and such (hello perl).
For those who don't know, Rails is an application framework which is supposedly capable of lowering the workload required to get things running by handling some things for you and by generating some base files for you to edit, kind of like a R.A.D. IDE but without the drag and drop design interface.
Ruby is another multipurpose interpreted language which is supposed to be a fair bit like python (YAY!!) or a better alternative to perl (the name ruby was chosen to compliment the name of perl).
Anyway, once I'd installed ruby and then rails via ruby's gem package manager (I know, it all sounds very *nix-ish, but I am using XP) and I had downloaded the .mov that shows how to make a blog in such a short time, I was pretty much set (I already had a better version of SciTE installed and I had to download the movie so I could resize it to gain access to the quicktime controls... stupid apple media player).
The first thing I noticed about the movie was how the guy walking us through it has one of those really irritating voices and a tendancy to say "whoops" when ever he does something, but as he is one of the more integral developers of rails, that can be forgiven.
The first thing I noticed is that rails seems to start off doing a fair bit of hand holding in terms of generating the directory structure and binding stuff together.
I don't think this is a bad thing as not everyone knows PHP or some other web scripting language and it does save time.
The advantage of having the framework set up a fair bit of the database connection coding is that it both saves time, and reduces the need to type out masses of SQL queries (in PHP, I have often found myself either running the same sort of query multiple times for different things, or building functions just to get around doing that), but on the flip side, you don't get as much knowlage of SQL as you do with standard PHP and others.
Basically, once you've got your database made, you just modify one file which has your database setting in it, and bam, you don't have to worry all that much about the database end after that.
Once I had got the basics up using the movie as a tutorial, I thought I'd trawl google's murky depths for info I could use to add more functionality to my little blog which had been thrust into the world.
The thing is, rails isn't quite as mature as PHP or even Ruby, so documentation on rails can be harder to find, and even when you do find what you're looking for, don't always expect it to work 100%.
The movie is a good example of this as it quite happly goes through adding textile functionality (thing BBCode, but not), but neglects to mention that in order to use the textilize functionality of rails, you need to install another gem (gems are like libs or DLL's, they add more features to Ruby) called RedCloth...
I was sat there wondeing why the hell it worked for him, but not for me, so I googled it and after a bit of trawling, I found out about RedCloth and it worked (don't you just love inferior quality tutorials / demo's?).
Since documentation can be fairly hard to find on implementing specific features, I opted to add member features using one of the available authentication generators.
This was actually simple enough to do, just install (gem will try to do a remote install from the rubyforge website if you don't have the file on your system), generate a login system with:
ruby script/generate install user
And tell it what to protect and such.
With that done, I thought I'd play around since rails has built in AJAX support (AJAX is a way of creating a dynamic interface by using the xmlhttprequest object and javascript with a server side language like PHP or RoR, AJAX isn't another language).
I decided that it'd be cool if I could have something similar to
Typo, which is made with rails and has neat effects when adding or removing comments from blog entries.
To do this, it just took a bit of editing to 2 files, but I didn't have to use any other scripting language than ruby as rails did the AJAX for me.
Well, that was almost smooth sailing... It fades the comments from view, updates the database and then scrolls down a list of comments in a pretty attractive way, but due to my inexperience with Ruby on rails and the standard of some of the documents I was reading, it doesn't seem to like showing the comment right after it's added and you end up refreshing to see it... (I don't know if this is because of me or what, but I'm guessing so)
When I ran the stats using ruby's rake tool, it came out that I had managed this with 165 lines of code if you count the fact that I also shipped the skin of my PHP blog to the rails version and the mistakes I have made while stumbling through this first endevour.
The end result has been that I have pretty much replicated a blog I built with PHP using rails, minus a skin changer and gzip compression, but I have also added some things to it which my puny knowlage of javascript would have made quite difficult with PHP and without using mod_rewrite, I already have nice looking url's.
I'm not sure rails will be the next big thing after PHP, but it has definitely thrown the idea of a framework for web developemtn into the view of many more web developers than others before it, which is probably why projects such as PHP on TRAX have sprung up (formerly PHP on rails) and I definitely think there's some future for similar web frameworks.
PHP, CSS, XHTML, Delphi, Ruby on Rails & more.
Current project: CMS Object.
Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
Release date: NEVER!!!
Comments
are you interested in writing articles like this?
i might be interested in adding a section of amazing articles written by nuvo to my website. there will probably be money involved, but no too much. Just a heads up
an excellent post btw, i found it very interesting as it took me 2 whole minutes to read the whole damn thing! and i read fast !!
excellent job though, now when are you going to become a moderator!
I didn't actually mean for it to be quite so long, nor did I intend to rewrite the demonstration from the tech demo "rails_take2_with_sound" quicktime file.
If I had wanted to do that, I probably could have, but to do it now would probably require that I start over since tinkering = good, tinkering with a system which does a lot for you and which uses a language you have never used before without writing as you go along = bad.
I have never charged for articles or anything like that...
You keep ranting about making me staff, but I didn't join DD with any intentions of being made staff or anything.
Current project: CMS Object.
Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
Release date: NEVER!!!
PS:
The narrator of that video was terrible btw.
Submit your threads
Music Forum
My Web Entrepreneur Blog
VolumeBoost - Member Chosen Music News
Current project: CMS Object.
Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
Release date: NEVER!!!
Ruby has got to be my favorite scripting language by far.
I think (or perhaps it's more of a hope) that PHP will start to flail now that there are better alternatives available. Right now you pretty much have a choice between PHP, Perl, Ruby and Python as a portable scripting language. There's PHP with its lacking OO features and gazillion functions in global scope and Perl with its hideous and confusing syntax -- not a very productive environment for todays developers IMO. Python is nice, but isn't a true OOP language as Ruby is.
What I don't really understand is why Ruby and Rails has gained all the hype. Rails is hardly the first framework to make development so easy, and Ruby was never a very popular scripting language (outside of Europe, anyway, or so I hear)...
Webmaster-Talk.com
Chroder.com
I had heard of Ruby, but I had never used it before I tried Rails simply because everyone I knew who had tried it said it was awful when compared to Python and similar languages.
I agree that Perl is a bit lame by todays standards, but PHP isn't that bad.
PHP's syntax is good if you know C++ or other such languages while Ruby has a fairly different syntax from what many will be used to.
Rails probably helped Ruby get some attention because of how easy it is to use and because of how well it integrates with databases.
Rails handles all the database stuff for you and the fact that virtually everything in Ruby is classed as an object means that you don't need additional functions to do simple things like reversing a string.
Current project: CMS Object.
Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
Release date: NEVER!!!