Thoughts on Technology, Methodology and Programming.

Archive for the ‘RoR’ Category

Links for 1 November 2007 (Rails, JavaScript, HTML, Photoshop, CSS, Microformats, Macs, Freelancing)

Posted by Marcus Wyatt on 1 November 2007









Technorati Tags: , , , , , , ,

Powered by ScribeFire.


Posted in CSS, Development, JavaScript, RoR, Software | 2 Comments »

Links for 31 October 2007 (Ruby, Rails, Rails Plugins, RSpec, RBehave, CSS, JavaScript)

Posted by Marcus Wyatt on 31 October 2007



Rials plugins

RSpec & RBehave



Technorati Tags: , , , , , ,

Powered by ScribeFire.

Posted in BDD, CSS, JavaScript, Rails Plugins, RoR, TDD | Leave a Comment »

Links for 30 October 2007 (Rails, Ruby, JavaScript, CSS)

Posted by Marcus Wyatt on 30 October 2007


Rails Plugins




Technorati Tags: , , , ,

Powered by ScribeFire.

Posted in CSS, JavaScript, Rails Plugins, RoR | Leave a Comment »

Links for 29 October 2007(Rails, Dsl, JavaScript, CSS, TextMate)

Posted by Marcus Wyatt on 29 October 2007


Domain Specific Language



Web General

Technorati Tags: , , , ,

Powered by ScribeFire.

Posted in CSS, JavaScript, OO, RoR, TextMate | Leave a Comment »

acts_as_attachment on $^@#$ windows

Posted by Marcus Wyatt on 16 August 2007

Why would you use windows to do this man?

Because I haven’t bought that nice shiny MacBook Pro yet… But enough of that… So I’m building this Rails app that needs to display images. So where do I look first, of course techno-weenie and the great tutorial from Mike Clark on File Upload Fu. So the long and short of this is the following:

I tried to get the local file system upload to work, but firstly I run into problems to install the ImageScience library. I not only using window operating system, but I’m running XP x64. So I even had issues finding make/nmake for 64 bit. So I decided to use RMagick.

Next, I installed RMagick and with a tweak to the rmagick_processor.rb file and by commenting the validates_as_attachment in my model class I was able to create the images on the file system. I’ve added the bang(!) operator to line 8. i.e. image.resize!(cols, rows)

   1: # Performs the actual resizing operation for a thumbnail
   2: def resize_image(img, size)
   3:   size = size.first if size.is_a?(Array) && size.length == 1 && !size.first.is_a?(Fixnum)
   4:   if size.is_a?(Fixnum) || (size.is_a?(Array) && size.first.is_a?(Fixnum))
   5:     size = [size, size] if size.is_a?(Fixnum)
   6:     img.thumbnail!(*size)
   7:   else
   8:     img.change_geometry(size.to_s) { |cols, rows, image| image.resize!(cols, rows) }
   9:   end
  10:   self.temp_path = write_to_temp_file(img.to_blob)
  11: end

Now I was on the hunt to solve the validation issue “Size is not included in the list”. Firstly I found this and this solutions, but neither solved the issue. Then I found this solution and great my issues is solved. Whoa!

Then I tried to change my storage to Amazon S3 and although the images are resized and uploaded, there was something wrong with them. Some images where mangled and other had no image. So now I was worried!

It turns out that there is a problem with the tempfile.rb within Ruby. So I found this solution and now I have a working solution. Awesome!

Damn windows…

Posted in RoR | Leave a Comment »

Ruby in Steel Goodness

Posted by Marcus Wyatt on 20 June 2007

I’ve had a play with Ruby in Steel for Visual Studio 2005 when Sapphire Steel released the first Developer edition about a year ago. The first version on my system was clunky and painfully slow. The Ruby intellisense was slow and overall the experience was not great.

Well, why would you tell this to me know?

Because, earlier this week my eye caught a post about Visual Ruby in my aggregator. So I browsed over to the post and then got reminded about Ruby in Steel. So I decided to give it another try. Wow, what an improvement.

The debugging features are just brilliant. So seamless, you would think you’re working within a language like C#.

The intellisense is crisp and rdoc information is displayed where available:


The following Intellisense features for Ruby source files are implemented:

  • Member Completion Lists
  • Keyword Completion Lists
  • Variable Completion Lists
  • Quick Info Tooltips
  • Parameter Info Tooltips

You also have the Snippets features of visual studio for template functionality.


Another cool feature is the Ruby Explorer which is a class browsing tool which can be used to view an alphabetical outline of Ruby classes and methods.


All in all I’m really impressed by the progress the tool made since the version 1.0 release a couple of months ago. I’m seriously considering maybe to invest in a license for the tool. But I think they should seriously consider the freelance developer out there. When ReSharper announced their personal license I was really excited about the move and yes, I did buy a personal license. Hopefully the Sapphire Steel guys would consider something similar…

If you are a  .NET developer for food and a budding RoR developer for fun and don’t have that flash MacBook Pro yet. Then maybe Ruby in Steel is just what you’d need.

del.icio.us Tags: , , ,

Posted in Development, RoR, Software | Leave a Comment »

Rails scaffold method problems (actually connection)

Posted by Marcus Wyatt on 1 November 2006

I’m trying out Ruby in Steel the past week and where pulling my hair out because the scaffold method did not work. The database was hosted on a SQL2005 server and I did not think you need to do anything special to use Ruby in Steel against SQL.

So after a couple of hours trying to solve the problem, I decided to try my project against a MySQL database and scaffold worked. So I figured that there must be a problem with rails connecting to the sql database.

If you get the following message “identical test/fixtures/posts.yml is not a class/module” when running script/generate scaffold, then you have a problem connecting to the sql database (that’s of course if you using sql as your data store).

I found a solution to the SQL2005 connection problem on a fellow wordpress blog.

Just in ram posted the following:

It appears rails does not connect to MS SQL Server right out of the box. You need to do the following to get the connection to work:

NOTE: These instructions are a tweaked version of http://wiki.rubyonrails.com/rails/pages/HowtoConnectToMicrosoftSQLServer

Get the latest source distribution of Ruby-DBI and copy the file:




NOTE: The ADO directory does not exist on a standard install, you will need to create it.

Then simply set up your railsapp/config/database.yml

Here’s an example for reference:

  adapter: sqlserver
  database: database_name
  host: server_name
  username: user_name
  password: your_pw_here

Thanx… just in ram

Posted in RoR | 1 Comment »

Great BDD and rSpec Tutorial

Posted by Marcus Wyatt on 1 September 2006

Luke Redpath posted a great rSpec and Behavior-Driven Development tutorial that is one of the best I’ve read in awhile.


tags: , , ,

Currently listening to: DJ River / VA – DJ River – The Resolver (Winter 2006) [DJRiver.com]

Posted in BDD, RoR, TDD | Leave a Comment »

Ruby on Rails testing links

Posted by Marcus Wyatt on 31 August 2006

Following is a few links to RoR Testing tutorials:

Not a bad introduction

In depth testing walk through. Long.

Another walk through. Not Rails. Long also.

ActiveTest. Looks interesting but not so interesting that I would use it.

Autotest (and Zentest). Very useful for hard core tdd.

Code coverage tool. This is a must and is dead easy. There is no reason why you shouldn’t use this.

Testing cheat sheet. Big list o’ asserts http://nubyonrails.com/articles/2006/08/24/ruby-rails-test-rails-cheat-sheet

Misc stuff…

Coloured test output

Several articles about ruby-prof on this blog http://on-ruby.blogspot.com/

Memory Leak Testing.

Kent Beck Podcast. Worth a listen.

Posted in RoR | 3 Comments »

Charlie "Discovers" Ruby

Posted by Marcus Wyatt on 31 July 2006

Charlie Poole (From NUnit Fame) does a brilliant intro post on discovering Ruby:

This week at OSCON 2006 I finally learned some Ruby. I’ve been meaning to do this and learning by listening to Dave Thomas and Mike Clark seemed like it would be much more fun than simply reading a book. Turns out I was right.

In the process, I discovered a cool thing about Ruby and invented a really neat way to use it. Except not really: other folks already knew about my “discovery” and my “invention” has been invented a few times before! Oh well! It was fun and I learned a lot. If you don’t know Ruby, some of this may be new to you as well. If you do know it, perhaps you’ll find something to smile about here.

Technorati Tags: powered by performancing firefox

Posted in RoR | Leave a Comment »