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:
Post a Comment