Which version of Ruby? - sql

I'm just starting out in Ruby (Rails actually) and the book I'm reading covers Ruby 1.8.6, RubyGems 1.0.1, Rails 2.0.2 and SQLite 3.5.4, but the current stable releases of these are 1.9.1, 2.3.8, 1.3.7 and 3.7.0 respectively, should I still proceed with the book or find another?
Also, I couldn't find a recent guide/tutorial to walk me through the installation of these latest versions, would be great if you could help with that too. I'm on Mac OSX Snow Leopard (10.6.4).
Many thanks!

There are a large number of projects with major release milestones just around the corner. These include Ruby 1.9.2 (the 2nd RC is already out), Rails 3.0 (the RC is already out), and a number of other libraries and plugins. Please note that Rails 3 does not support Ruby 1.9.1, although it does support 1.8.7 and 1.9.2.
I would start out with Ruby 1.9.2-rc2 and Rails 3.0.0.rc. These are what will be the current version over the next few years, starting within the next few weeks. Previous versions of Ruby and Rails will be legacy.
Look for new editions of books coming out, having been updated for Ruby 1.9.2 and Rails 3.0.

I were like you. Although Ruby is popular, they are very bad and inconsistent in such kinds of various versions. Firstly, I thought that the latest version is always the best, which holds the true for most languages. Later, in these days, due to the removal, re-structure and redesign of logic and underlying codes, the latest version is not always good for programmers who are used to writing codes in older version. See python case (2.x vs 3.x).
So, for ruby, if you're holding a book that teaches you in ruby 1.8.x, then just relax and adhere to 1.8.x. Install 1.8.x version and Practice. Same for 1.9.x and other versions. Or else you'll end up with frustration like "why doesn't my code run?".
The most important thing is RubyGem. RubyGem is also stick to ruby version. Gems that run in 1.8.x are not usually compatible with 1.9.x. So, keep that in mind. Or else you're unhappy that you install this gem and you can't call it - its objects.
Now, my practice is that I install every version. I exclude ruby path and its lib in PATH variable. When I want to switch between each version, I use BAT/bash file that set variable for each version like PATH=$PATH:/opt/ruby18 .
I've also asked many questions about this in many forums. As you know, the life and true aspect of programming is to (re)use libraries and objects. If certain libraries don't work with a certain version of ruby, then you have to switch to others. This is also my bad feeling about ruby. They really should have backward compatibility.
Maybe others can solve this problem smarter than me. But it really messed up with my programming life.

Checkout RVM, use it to install different versions of Ruby/Rails on your machine without root access. It will make your Rails development easier :)

railstutorial.org walks you through the installation of everything you need on OS X. It's also more recent than the book you're using.

Take your pick, the Rails book or the version that you specifically need to learn.
Once you decide on a book, install the versions of the language / gems as mentioned in the book. e.g. Rails 1.2 and Rails 2.0 had pretty big differences and the tutorials wouldn't work.
If you're learning Rails, pick a well known book, install the specific gems. Once you're done with the book, you'd be in a better position to look at the differences and migrate to higher versions with less hassle.
gem list rails --remote
gem install [gemname] --version [version]

Related

PHP7 compatibility with Symfony3?

With the release of both PHP7 and Symfony3 this week, have Symfony3 been developed with PHP7 in mind?
To put it another way, if we have PHP7 installed and are starting a new Symfony3 project from scratch, do we run the risk of facing migration problems from within the Symfony framework?
PHP 7 is mostly backward compatible with 5.x versions. Most of the changes that are incompatible with previous versions consist of the removal of quirky features anyway. This is usually not the type of stuff SF developers tend to use.
And, yes, SF3 has been developed with PHP7 (and HHVM, by the way) in mind.
PHP 7 is backwards compatibly unless a featured has been deprecated. Symfony3 is 100% PHP 7 compatible and is built using PHP 7.

Where's a Gemfile.apk tutorial? Or the default Gemfile.apk gems?

Ruboto rules like no Android development environment has ruled before. It's like the best of Rails combined with the best of the standard Eclipse-Java-Android environment.
Oh, except it's too new & green to even have tutorials or workarounds or even newbie QA in the forums.
For example, I can install Ruboto, and run it, until I try to add a gem to my application. The instructions seem to say to write a Gemfile.apk text file, and put your gem calls in it.
The problems start when I add a gem to that file:
source "http://rubygems.org"
gem 'wrong'
Then the system starts requesting other gems, such as thor, sqlite3, and Rails. Sometimes, it starts complaining about the versions of sdoc and rdoc. That's a story for another post. The upshot is the system asks for gem files one at a time, and expects specific versions.
This leaves me curious where a "master Gemfile.apk" is. So I can get into it, maybe bundle-install it, and I can stop screwing around with versions & mismatches and s--t.
The versions are ruby 1.9 to 2.1.1, and Ruboto 1.0.3.
A long question with many parts :) I'll try to cover all, but feel free to file an issue in the Ruboto tracker or ask on the mailing list or on the IRC channel if you need more info ( http://ruboto.org/community.html ).
You can find tutorials here:
https://github.com/ruboto/ruboto/wiki/Tutorials-and-examples
You can find the FAQ here:
https://github.com/ruboto/ruboto/wiki/FAQ
Tutorials showing use of Gemfile.apk:
https://github.com/ruboto/ruboto/wiki/Tutorial%3A-Using-Bundler
https://github.com/ruboto/ruboto/wiki/Tutorial%3A-Using-an-SQLite-database-with-ActiveRecord
https://github.com/ruboto/ruboto/wiki/Tutorial%3A-write-a-gosu-game
There is no "master Gemfile.apk". Only the gems in the Gemfile.apk and their dependencies should be installed into libs/bundle.jar and included in your app.
I hope this helps you get going. If you see opportunities for improving the documentation, we are open for contributions.

Does Radiant support Rails 3 now?

I use gem install radiant to install radiant, and I found that it doesn't support Rails 3. But, I found there is a file named "GemfileRails3" in the source code of Radiant on Github, I wonder why is that. Does Radiant really not support Rails3?
Radiant still does not support Rails 3 at this moment. A lot of work towards that has been done, but the project is lacking momentum, making it hard to say when this can be released.

Can I "move" my gems while upgrading Ruby 1.8.7->1.9.3 and Rails 3.0->3.2?

I am Ruby/Rails beginner, and I am on Windows.
I just used RailsInstaller to upgrade from Rails 3.0.9 to 3.2.3, from Ruby 1.8.7 to 1.9.3. The gems that I installed previously no longer appear when I type gem list. I assume this is normal.
My question is: Is there a way to get all of those gems "into" Ruby 1.9.3 without individually re-installing them?
When I went into an old rails apps and ran bundle install, it appears that a few of my gems were re-installed (the ones in the Gemfile).
Any help would be appreciated. Sorry if I am missing something obvious.
If you're just upgrading to a new version, as long as everything that was in your Gemfile was installed when you ran bundle install then I wouldn't worry about it. Just re-install gems as you need them instead of bloating your system with gems that you don't currently need.
If you have projects that you are porting over to the newer versions of Rails and Ruby, you can just run bundle install as the first step in upgrading the app to make sure its dependencies are installed.
Maybe someone could give you an yes/no answer for transitioning with RailsInstaller, but I'm trending toward using rvm and gemsets to have a cleaner, more focused environment for each project.
If you want to switch back and forth between multiple ruby versions, maybe check out the gem pik. You can use it to install gems on multiple versions of ruby so that they're available across them all.

Which version of rails to use

what is the best when it come to choosing what version of rails to use in your development?
I wanted to upgrade to the newest version for the new features, but in many cases chances were high that my existing code would be broken, and a lot of extra time definitely needed to spend fixing it. Should I stick with the current version of rails I'm using? or heading for upgrade?
Any advice or guideline would be really appreciated.
It is useful to always upgrade, because new gems might not support older versions of Rails and you wil get new features from Rails which could reduce code. You can do it step by step, fixing time to time code that will break in newer version of Rails. It more like continuous refactoring.
I think you have to check carefully when and how to upgrade. Here are some hints that may help in the upgrade process:
Patch versions (like upgrade from Rails 3.1.0 to Rails 3.1.1) were normally no problem at all. Upgrade whenever possible, normally you don't have to change anything. Sometimes you have to check if other Gems as well should be upgraded, read the release notes, they give (sometimes) hints about that.
Minor versions (like upgrade from Rails 3.0.9 to Rails 3.1.0) come with new features and non-compatible changes. In the release notes, you will find information what has changed and has to be proven before hand. As an example, look at Ryan Bates railscast "Upgrading to Rails 3.1.0". You normally have to do the following steps:
Upgrade to the last patch version before.
Look at the deprecated log messages. These are the ones that may break after the upgrade.
Tag your current application, or branch to be sure to not destroy anything by the upgrade.
Do the upgrade up to the point you are sure most needed features work again.
Merge back your changes, and continue with the upgrade
(Have done that the last few days for an application I have upgrade from Rails 1.2 to 2.0 up to 2.3.8 to 3.0.0 up to 3.0.9, and now 3.1.1.)
Major version upgrades are even more difficult. You have to ensure that you have enough time and resources to check all the minor glitches you may have. Most of the time, there were resources available by the Rails team that help do the upgrade, like the Rails upgrade helper or the 3 railscast "Upgrading to Rails 3".
In any case, you should at least check if the main Gems you are using (additional to the normal Rails gems) are compatible with the version you want to migrate to. This may be tricky, but sometimes, the information is available.
My experience is, that Major upgrades take time, and if you don't have it, don't do the upgrade. Minor upgrades take some time, and depending on the change (assets in Rails 3.1) come with a price tag, which is sometimes, not all of the times, worth it. Patch upgrades are painless and should be done at will.