My blog has moved!

You should be automatically redirected in 6 seconds. If not, visit
http://kavachai.com
and update your bookmarks.

Showing posts with label ruby on rails. Show all posts
Showing posts with label ruby on rails. Show all posts

Tuesday, April 7, 2009

Multiple Models in One Form

At "The Pragmatic Bookshelf" there is an extract from "Advanced Rails Recipes" by Mike Clark that explains how to properly handle dynamic creation/removal of the dependent models on one form using ajax.
Here is the link Recipe 13.

Monday, March 23, 2009

Handling move from Rails 2.2.2 to 2.3.2 version

As I preffer to work on virtual machines (by the way my personal choice is VMware) I used one of them while getting in touch with Rails. I had version 2.2.2 installed there.
Today I created a new VM for working with Rails and found out that 2.3.2 version of Rails appeared there as a result of installation. New version of Rails arrived :)
Unfortunally I was not able to run any of my demos :(

To fix this issue I started with change in "config/environment.rb" by updating
RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
to
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
Then I had to run "rake rails:update".

Thats it. These two steps brought demos to life :)

Tuesday, February 3, 2009

Getting Ruby on Rails 2.2.2 working on Windows XP

When installing Rails 2.2.2 I ancountered a problem with sqlite3. Although sqlite3 is a default database used by Rails starting from version 2.2.2 on Windows XP is not such a trivial thing to make it work.

I started by trying to install sqlite3 using gem like this:
gem install sqlite3-ruby
But I got an error:
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.

C:/ruby/bin/ruby.exe extconf.rb install sqlite3-ruby
checking for fdatasync() in rt.lib... no
checking for sqlite3.h... no

nmake

Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

NMAKE : fatal error U1073: don't know how to make 'ruby.h'
Stop.
The solution is quite strange from my point of view:
  1. Download sqlite and sqlitedll from sqlite downloads (by now they are "sqlite-3_6_10.zip" and "sqlitedll-3_6_10.zip").

  2. Unzip both archives to Ruby bin folder ("C:\ruby\bin" on my machine). There should be three files: sqlite3.exe, sqlite3.dll and sqlite3.def.

  3. Install sqlite-ruby using such a command:
    gem install sqlite3-ruby --version 1.2.3
The strange thing is that if you do not use the version parameter installation will be unsuccessfull.