Wednesday, March 12, 2008

Using a 'blob' with ActiveScaffold

So I'm using ActiveScaffold to create an admin interface for a site, using a legacy database. It has a table called 'Events', one of the column names is event, of type medium blob, which will only contain text. ActiveScaffold will display the contents of the blob field correctly, but when you go to create a new Event or edit an existing one, it will not give you a text field to enter anything in. Here is the fix:


In app/helpers, I created a file event_helper.rb and put this code in it:



module EventHelper

def event_form_column(record, input_name)
text_field :record, :event, :name => input_name
end

end

And everything worked fine.

No comments: