Hi nice guys!
I've been using Rails for a couple of days. I've got to say that Rails do meet the buzzword expectations... Every part of Rails amazes me, especially Active Record. I come from the PHP world where there are vast choices of "DB abstraction layer" we can choose, from the "minimalist" PEAR DB, to PEAR MDB, and what I'd say the most advanced ones like Creole+Propel. Active Record definitely wins by several hands. I wonder how much time David (and Rails contributors) has spent on Active Record alone, let alone the entire Rails package. The Migration feature is very handy, the concept is simple yet it works. Some packages like PEAR MDB uses schema comparison approach, which is very complex (especially for MB developers) and also not very easy to use. Although MDB's technique also automates it a bit (basically you define a target schema, and MDB will modify the current database to match the target, but I like Migration's approach much better).
Anyways, I've come across several problems. Maybe bugs, maybe not. In any case I was hoping if it can be enhanced even if not fixed, so not everyone will face these problems again. At the very least, giving a helpful error message would be really great. So, let's get started...
The first difficulty is getting the first Rails app to work. I'm using Ruby one-click Installer on Windows XP. The installer works great. Rails, though, not that smooth. I choose to download the "rails-x.x.x.tgz" since it claims to have the entire package (I do aware that Rails uses activerecord, etc. gems, but I don't download it since the "entire package" supposedly has them). Note that I don't have active Internet connection, I go to Internet cafe to download all the stuff I need then I go back home to try what I've downloaded. That means if I missed a needed part, I've to go back to Internet cafe again, and that's not nice.
Extracted rails-1.1.6.tgz. Trying... But, it turns out that "ruby script/server" fails:
D:\rails>ruby script/server => Booting WEBrick... c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_re quire': ./script/../config/../config/environment.rb:8: parse error, unexpected ' <' (SyntaxError) <%= '# ' if freeze %>RAILS_GEM_VERSION = '<%= Rails::VERSION::STRING %>' ^ from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `re quire' from ./script/../config/../vendor/rails/activesupport/lib/active_support /dependencies.rb:147:in `require' from ./script/../config/../vendor/rails/railties/lib/commands/servers/we brick.rb:52 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `ge m_original_require' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `re quire' from ./script/../config/../vendor/rails/activesupport/lib/active_support /dependencies.rb:147:in `require' from ./script/../config/../vendor/rails/railties/lib/commands/server.rb: 30 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `ge m_original_require' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `re quire' from script/server:3
Definitely not a very nice experience.
After banging my head several times, I figured that I've to download the rails gem and all the gems it requires. Another roundtrip to Internet cafe. I can't find a page on Rails download page that lists direct link URLs to all gems I need [BAD], maybe it's somewhere but it should be very visible upfront to avoid frustrations. I also can't find a Rails download that includes all the Rails gems and its supportive files in one .tgz or .zip file (BAD). I'm aware of InstantRails, but it seems more like a "distro" rather than a collection of needed support files, therefore I don't download it.
The "solution" is to install Ruby on the computer that's connected to the Internet. Then I execute the recommended way of installing rails : gem install rails --include-dependencies Took some time. But it works. The problem is, you can't just install Ruby on every computer you need to use to download Rails. Why not just pack a bunch of gems in one tgz/zip to make some people's life easier?
The problem was, how do I copy the required .gem-s to my computer? It turns out I have to mess with C:\ruby\lib\ruby folder to find the gems I need, copy those to my flashdisk and bring them home. OK, mission accomplished.
[another annoyance, not directly related to Rails] The problem with installing .gems from localdisk is that gem doesn't seem to autoinstall dependencies (not like online gem install from Internet). The way that some people actually think that most people in the world have 24-hour Internet connection at the luxury of their home computers definitely disgusts me (sorry). After manually installing all required gems, a call to rails to build a site, then 'ruby script/server' works. Oh, at last.
But why did I has to be so painful to get here?
A side note: Installing Apache + PHP on Windows is also not that easy (it's much harder than installing Ruby/Rails, IMHO, requires you to edit some files like httpd.conf, php.ini, PATH env, etc.). At the very least, it doesn't require active Internet connection and having to install some program (like Ruby + rubygem) just to download something. All I need would be the Apache binary package, the PHP zip package, and the PHP manual which contains everything you need to know to install, configure, develop (it includes User Guide as well as Reference), even to create PHP extensions using C! (the enhanced CHM version even comes with user comments, definitely a plus).
Sorry for the complaints, but it'd be great if we could have more ways to make Rails better and easier to use.