Error while getting image from MSSQL database

I am trying to display an image stored in my MSSQL database in my Rails
2 application. As a test example I have written a C# application that
displays the image on a form which works. So I know the image in my
database is correct.

However when I try to retrieve the image by the following code it gives
me an rails error:

def show_account_logo
@account = Account.find(params[:id])
send_data @account.account_logo, :type => ‘image/png’, :disposition =>
The following error is returned:

NoMethodError (undefined method unpack' for #<Array:0x15b8fc44>): c:/ruby/lib/ruby/1.8/base64.rb:59:in decode64’
binary_to_string' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/attribute_methods.rb:211:in account_logo’
send' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/attribute_methods.rb:240:in method_missing’
/app/controllers/manage/user_controller.rb:526:in `show_account_logo’

The following link on the internet is supposed to have the solution,
however that page doens’t exist any longer.

Any help would be appreciated.


Wow this seems to be a very old version of the sqlserver adapter
Could you please try it with the current version 2.3.24 ?

Hi Klaus,

almost ashamed to say it, but yes. You are right. Needed to update my

Thx alot!