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 => 'inline' end The following error is returned: NoMethodError (undefined method `unpack' for #<Array:0x15b8fc44>): c:/ruby/lib/ruby/1.8/base64.rb:59:in `decode64' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-184.108.40.20650/lib/active_record/connection_adapters/sqlserver_adapter.rb:134:in `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' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/attribute_methods.rb:240:in `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. http://blog.mcmoyer.com/2007/9/18/using-ms-sqlserv... Any help would be appreciated.
on 2012-10-05 11:57
on 2012-10-05 15:47
> "activerecord-sqlserver-adapter-220.127.116.1150" 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 ? See: https://github.com/rails-sqlserver/activerecord-sq...
on 2012-10-08 13:50
Hi Klaus, almost ashamed to say it, but yes. You are right. Needed to update my sql-server-adapter. Thx alot! Benjamin