Archived

This forum has been archived. Please start a new discussion on GitHub.

IceRuby in RubyonRail

I am very happy with the ice document which helped me lot to work with ruby.

I am success in running my ruby client. but please help me how i can use IceRuby in RubyonRail controller.

when i use my client code :
====================
require 'D3I.rb'

status = 0
ic = nil
begin
ic = Ice::initialize(ARGV)
base = ic.stringToProxy("SessionFactory:tcp -p 10000")
twoway = D3View::ISessionFactoryPrx::checkedCast(base)
if not twoway
raise "Invalid proxy"
end

session = twoway.CreateSession()
puts "Got session #{session.GetID()}"
puts '
'
puts session.MetaDatabasesAsXML()
puts '
'
olv = session.LoadObjects("APAL3DB", "AP3Customer")
olvID, iNumRecs = olv.AsXML(0, 2)
puts olvID
puts '
'
puts iNumRecs
#puts olv.GetID()
rescue Ice::Exception => ex
puts ex
end
exit
====================

in my controller :

======================
require 'D3I.rb'
class ItemController < ApplicationController
def list

client.rb (code)

end

=====================
i get error Slice preprocessing failed for `D3I.ice'


please help me how to use client ruby in rubyonrail controller

thanks

rama

Comments

  • benoit
    benoit Rennes, France
    Hi,

    I don't see any directives in your code to load the D3I.ice Slice file so it's not clear to me why you would get an error related to the parsing of this file.

    I'm afraid you don't provide enough information. Does it work if you run your application with the Ruby interpreter? Can you copy/paste the exact error message?

    Cheers,
    Benoit.
  • I can attest that using IceRuby code in Raills applications works fine, as we do it here.

    The only problem I've ever run into is that I needed to slice2rb my ice files instead of using Ice::loadSlice on them. I think there is an issue with caching information, keeping the interpreter alive, and constant calls to Ice::loadSlice every time a page loads/reloads that was giving the ruby interpreter fits.