ruby on rails

Ruby on Rails is our favourite web development tool. It really gives us wings and let's us build great stuff for people without everything becoming a major project.

RSpec Tutorial

Tagged:  

Ben Emson, one of the founders of the rapidappsgroup has recently written this excellent tutorial on RSpec.

Ruby on Rails not rendering HTML in browser

I've just noticed someone has come to our blog after searching for the terms in the title of this page. It reminded me of a frustrating hour or so when I first started using rails where the RHTML page I was writing was doing (or not doing) just that. Just in case anyone is having the same newbie problem I'll hold my hand up say it was this:

make sure any embeded Rails code is surrounded by these delimeters:


 <%=      %> #(note the equals)

and not these:


<% %>

Hope this helps.

corporate web 2.0 & mobile

Ruby on Rails intranets for the Microsoft Shop

We've successfully deployed four rails apps to a Microsoft Shop saving them a whole load of time and money. This article covers the issues we came across. Find out more about Rails in a Microsoft Environment

Ruby on Rails, odd behaviour with common terms

I added a 'display' property to my job model to determine if that job should be displayed in some graphs on the web application I was building. When I came to accessing that value using check_box('job', 'display') the checkbox remained blank no matter what value was in the underlying model. Odder still, if I selected the checkbox and submitted then the correct selected value would go through so I was getting an end-to-end from view to database it's just that the checkbox control was behaving oddly.

Ruby on Rails, rake migrate add_column fails with The error occurred while evaluating nil.[]

This one had me stumped for a while:

I was attempting to add some columns using rake migrations but kept getting this error:


rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]

when running the migration below. Unfortunately it was the first time I'd used add_column so my immediate assumption was that I'd done something wrong.


class AddVatAndDisplayColumns < ActiveRecord::Migration
def self.up   

Debugging Ruby on Rails, Prototype Helper and Ajax

Tagged:  

It can be hard to debug server side errors when using ajax calls. There are quite a few options out there but I'm posting mine simply because it's been so robust and helpful.

First I add this to my application.js javascript file:


function show_ajax_error(request){
	var error_win = window.open("about:blank","ajax_error", "width=300, height=200, 
        resizable=1, scrollbars=1");
	
        error_win.document.write(request.responseText);
	error_win.focus();
	error_win.document.close();
}

Ruby on Rails, RJS Ajax id helper

Tagged:  

We built an ambitious application that utilizes quite a bit of ajax to allow users to add and edit items in place such as purchase orders whilst also allowing them to add child items to purchase orders such as invoices, editing those in place too. This required quite a lot of manipulation of DOM objects using RJS through IDs. Although a small feature, what has proved very useful is an ajax_id_helper, simply a helper class that generates ids for DOM objects in web pages that cam also be subsequently used by the rjs files that need to identify those objects and manipulate them.

Ruby on Rails, Active Record and Microsoft Sql Server

It became necessary to connect a Ruby App running on Windows Server 2003 from its nice local MySQL database to a remote Sql Server database instead. In fact the process was very simple if just a little different many of the posts I'd read on the subject.

Ruby on Rails intranet - online staff appraisals, surveys and project manager

Rails is often used for next-big-thing social networking but we've used it quite successfully for Intranet applications. Our clients have all been Microsoft centric so we've avoided placing the apps under Apache but created them as windows services using mongrel which has fitted well into a Windows only environment.

In many ways Rails excellent Ajax functionality makes it ideal for intranet applications which often need very rich user interfaces.

Our apps so far have been:

1. End of year staff appraisals
2. Satisfaction survey for students in a college

Ruby on Rails - testing generic searching

Tagged:  

I thought I'd been clever by writing a search function into my Ruby controllers that could pretty much take any valid search from a web page and convert it into a generic search by converting the parameters into conditions which Ruby then turns into SQL (thus avoiding the risk of sql injection). It seemed like a good idea at the time as I was writing quite a complex cost management tool and rather than write umpteen different search methods, a single catch-all method that could handle simple equality parameters seemed prefereable.

Syndicate content