|
|
|
|||||
|
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 |
|
|||||
|
Quote:
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
Code:
class IceController < ApplicationController
def ping
IceHelper::Client.new().main(ARGV)
end
end
(7) Start the "Printer" server, e.g., the C++ version: "demo/book/printer/server" (8) Open http://localhost:3000/ice/ping Take care, Andreas |
|
|||||
|
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 |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |