Tag Archives: ruby on rails

rails 3 and haml and unobtrusive javascript

I have created a Rails3 application, started with Haml/Sass and finding it awesome. I am also trying to do unobtrusive javascript.
Before, in Rails 2.3, I would have expected a remote-form to have an :update attribute, where you could specify a selector where the response of the remote method would be rendered.
Now it needs to be [...]

skipping slow tests in rspec2

For Test::Unit there is a module called skippy, that allows you to skip for instance slow tests.
I was looking for a way to achieve the same in Rspec. I am currently developing against Rails 3.0.0.rc, and using rspec 2.0.0.beta.19 and could not find anything. So i asked on the rspec mailing list and got a [...]

actionmailer attachments on windows

I have been having troubles sending e-mails using ActionMailer on windows. The simple code-sample:

my_filename="my_image.jpeg"
attachment "image/jpeg" do |a|
a.body = File.read(my_filename)
a.filename = File.basename(my_filename)
end

did not work. I did find an attachment inside my e-mail, but it was corrupt. It took me a while to figure out it could be something related to my development [...]

keeping observe_field and spinner in sync

I am using a lot of observe_fields in my views. I have two searches on my form, one with two fields one with four, and every time a user types something the observe_field is triggered and some search is executed via AJAX. To make sure the user knows what is going on, i use a [...]

mongrel_service beta troubles with space

I am switching back from using thin inside a service to mongrel_service, because when my thin-process is killed somehow, the service stills seems to be running. Mongrel_service can cope with this much better: it also keeps a check on your ruby process and restarts it if needed (at least in the old version, i hope [...]

accessing current_user in models

Up until now i was able to somehow circumvent the need to access the current-user in the model, by calling methods from the controllers and handing down the current-user.
In the MVC pattern, the model should know as little as possible about things the controller handles.
But now, i need a method that will check :before_save what [...]

Arrrrcamp

Went to arrrrcamp last friday (Arrrr as in Ruby, Rails, Radiant and, of course, Rhum!). It was the third edition of this unique ruby-on-rails event, and the third time i visited it ;) So i am a regular :)
The first year i was just starting ruby and my then-collegue and me learned a lot. [...]

observe_field in IE8: endless loop

My users showed me the weirdest problem today. In my application is a select-box that allows users to select the classification. When the classification is changed, the div containing the icons for the actions (and the classification-select-box itself) is updated to reflect the new classification. So i use an observe_field to watch the select-box, and [...]

using content_for jquery on document ready

In my Rails application i use a generic application.rhtml for all my pages. Amongst others, this code contains some jQuery code to manipulate my page

var $j = jQuery.noConflict()

$j(document).ready(function() {

// remove all alt-tags
$j("[alt]").removeAttr("alt");

[...]

missing ‘a’ with rspec and cucumber

I am developing Ruby on Rails on Windows platforms mostly. But using Rspec and cucumber on windows has a very strange side-effect: all a’s are missing as can be seen from the following screenshot:

Luckily, after some very extensive googling, i found a single blogpost with a fix!
Apparently it has something to do with UTF-8 [...]