Piku’s Blog

February 14, 2008

Braid updated to 0.3

Filed under: Git, Ruby on Rails — Tags: , , , , — Mihai @ 4:45 pm

Braid has been refactored and now supports svn and git, it uses merge-subtree for git repositories and git-svn to track svn repositories. The meta information format has been changed too, now uses YAML::Store

Version 0.3.2 is the latest currently released, it now fetches only HEAD  revision instead of mirroring the whole repository.

The commands has been changed, I have updated my guide on installing rspec with braid.

You can also see the usage with ‘braid help’.


February 4, 2008

Installing rspec with Braid [Updated]

Filed under: Git, Ruby on Rails — Tags: , , , , , , , , , — Mihai @ 7:08 pm

See my Braid 0.4 post for informations about how to upgrade.

Updated to work with the latest version (0.3.1)

Braid is a tool made by Cristi Balan and is a simple tool to help track vendor branches across different SCMs.

It was originally named giston, and was providing functionality similar to piston for git. Braid, however, will work with most SCMs as both source and host.

Warning, Braid is still under development and may change in the future.

To start you need to get and install, on a linux like my ubuntu you can do it by writing:

mihai@mihai-laptop:~$ sudo gem install main open4
mihai@mihai-laptop:~$ git clone git://github.com/evilchelu/braid.git braid
mihai@mihai-laptop:~$ cd braid
mihai@mihai-laptop:~$ sudo ruby setup.rb

For this example I will use it to install rspec (the development version) on a Rails project. Go to your project root and type:

January 21, 2008

Rails with_scope tip

Filed under: Programming, Ruby on Rails — Tags: , , , — Mihai @ 10:03 pm

While searching some documentation about has_many :through I’ve found Josh Susser’s blog called (very imaginatively) “has_many :through” and the article about Magic join model creation in Rails Edge.

It is about using << on has_many through associations, before that you could use them only on habtm.

The article is quite old, 19 August 2006, and Rails has changed a bit since then, with_scope is now protected so now instead of

Contribution.with_scope(:create => join_attrs) { self << book }


Contribution.send(:with_scope, :create => join_attrs) { self << book }

For more information about many-to-many associations also see Many-to-many Dance-off in which habtm and has_many through is compared and Rails documentation.

January 19, 2008

ActiveRecord ‘type’ error

Filed under: Programming, Ruby on Rails — Tags: , , — Mihai @ 10:03 pm

While playing with Rails and ActiveRecord with has_many :through associations found an interesting error

> Account.find :all
SyntaxError: compile error
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1748: syntax error, unexpected tINTEGER

It took me some time to figure this out so I thought it might be useful to post it here, maybe someone has the same problem.

The error is because of the ‘type’ attribute of Account model, in Rails it is reserved for single table inheritance. To fix this just do not use an attribute called ‘type’, rename it to something else.

Create a free website or blog at WordPress.com.