The blog of Rahoul Baruah from 3hv Ltd

What's going on?

My name is Rahoul Baruah (aka Baz) and I'm a software developer in Leeds (England).

This is a log of things I've discovered while writing software in Ruby on Rails. In other words, geek stuff.

However, I've decided to put this blog on ice - I would ask you to check out my business blog here (or subscribe here).

31 May, 2007

Markaby, Helpers and Select Tags

Markaby is great but it sometimes stumbles on helper methods. I've mentioned that you need to add a to_s onto urls. One other is it gets the ActionView::Helpers::FormOptionsHelper.select function and the Html select tag confused. Reading through the comments in various places there are various suggestions to resolve this - none of which worked for me.

So I did this in app/helpers/application_helper.rb


# markaby doesn't like selects so give it something it does like
def drop_down object, method, choices, options = {}, html_options = {}
select object, method, choices, options, html_options
end


Now, in your view, instead of calling select you call drop_down :object, :method, choices and Markaby is happy. And the name drop_down? Well that's what most of my users call them so it makes sense to me.

No comments:

eXTReMe Tracker