Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 03-13-2008
dthompson dthompson is offline
Registered User
 
Name: Don Thompson
Organization: Digital Federal Credit Union
Project: credit card fraud monitoring
 
Join Date: Aug 2005
Location: south shore mass
Posts: 10
ruby-rails example code?

Does anyone have a sample rails demonstration application to share?
I am intrigued by ruby on rails but don't have the knowledge to implement an IceRuby example. I have a great demo database server which is based upon the demo/Ice/session example. The corresponding IceRuby demo client slightly modified lets me see the power of Ruby.
What I can't get a handle on is how rails would create and maintain the connections through the proxy objects, and how effective or ineffective this would be.
This would great help in making the decision about the web client development environment.
__________________
Don Thompson
Digital Federal Credit Union
www.dcu.org
Ice Project: credit union core processing prototype which may expand to open source project.
Current Environment:
Debian Linux Sarge,
mysql 4.1.11-Debian,
mysql++ v 2.1.0.beta1,
qt3 v 3.3.4,
Ice-3.0.1
IcePHP-3.0.1
Server: c++ using mysql++ to access mysql db, with Ice interfaces.
Desktop Client: c++ using qt3, Ice interfaces to Server
Home Banking Client: Python using IcePy interface to Server
Currently using PHP Client
Reply With Quote
  #2 (permalink)  
Old 03-13-2008
Andreas Scherer Andreas Scherer is offline
Registered User
 
Name: Andreas Scherer
Organization: Private Linux Site
Project: Evaluating Ice-C++, Ice-Java, Ice-Python, Ice-Ruby
 
Join Date: Mar 2005
Location: Berlin, Germany
Posts: 47
Quote:
Originally Posted by dthompson View Post
Does anyone have a sample rails demonstration application to share?
Not a full-blown Rails application, just a tiny example how one could cobble together some demo:

Assuming that you have the Ice demo tarball, you can start as follows:

(1) Create a new Rails application: rails Ice
(2) Copy "demo/book/printer/Printer.ice" to "Ice/public/Printer.ice"
(3) Create a Rails controller: ./script/generate controller Ice ping
(4) Edit "app/helpers/ice_helper.rb" to make it wrap the Ice::Application, resp. the Printer proxy
Code:
require 'Ice'

Ice::loadSlice(File.join([File.dirname(__FILE__),'..', '..', 'public'],'Printer.ice'))

module IceHelper
  class Client < Ice::Application
    def run(args)
        printer = Demo::PrinterPrx::checkedCast(
          Ice::Application::communicator().stringToProxy(
            "SimplePrinter:default -p 10000"))
        if not printer
          puts $0 + ": invalid proxy"
          return false
      end

      printer.printString("Hello World!")
  
      return true
    end
  end
end
(5) Invoke the Proxy in "app/controllers/ice_controller.rb"
Code:
class IceController < ApplicationController

  def ping
    IceHelper::Client.new().main(ARGV)
  end

end
(6) Start the web server: ./script/server
(7) Start the "Printer" server, e.g., the C++ version: "demo/book/printer/server"
(8) Open http://localhost:3000/ice/ping

Take care,
Andreas
Reply With Quote
  #3 (permalink)  
Old 03-14-2008
dthompson dthompson is offline
Registered User
 
Name: Don Thompson
Organization: Digital Federal Credit Union
Project: credit card fraud monitoring
 
Join Date: Aug 2005
Location: south shore mass
Posts: 10
Thanks Andreas. This will be great for me to get started. I think I can learn enough from this example to adapt to my specific sample ap.

Don
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
IceIdentity to Proxy in ruby PeteH Help Center 4 10-11-2007 06:19 PM
Ice for Ruby under Vista PeteH Help Center 5 03-06-2007 05:19 AM
Ice/Ruby/Qt example Andreas Scherer Comments 3 11-07-2006 06:00 PM
Ice for Ruby Preview Release now available mes Announcements 0 10-27-2006 01:55 PM
Ruby ICE binding jrimmer Comments 3 04-08-2005 09:32 PM


All times are GMT -4. The time now is 12:19 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.