RUBY

RUBY ON RAIL

exempleS en RUBY:

Pour le faire tourner sur IBM i, il vous faut :

    • Apache (57xxDG1)
    • et PASE (57xxSS1 option 33)
    • Dans tous les cas une bonne connaissance d'Apache de PASE et de la structure IFS sera un atout.

    • Pour créer le serveur, nous avons passé la commande :

      ===> RAILSNEW VRM(*V200) PLACE(*WWW) RAILSAPP(RUBY) DBUSR(XXXXXXXX) DBPASS(YYYY
      YYYY) DBROOT(RUBYDB) HTTPSRV(RUBY) EXTPORT(2222) INTPORT (2202)

      Notre serveur Apache a été configuré avec les directives suivantes :

##
## PowerRuby
##
LoadModule proxy_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_ftp_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_http_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
LoadModule proxy_connect_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
Listen *:02222
RewriteEngine On
RewriteRule ^(.*) http://127.0.0.1:02202/$1 [P]
ProxyPassReverse / http://127.0.0.1:02202/


  • et voici le premier test (suite à installation, comme indiqué ici : https://powerruby.worketc.com/kb?id=11


    Le serveur d'application est démarré avec la commande :
    RAILSSVR ACTION(*START) APP('/www/RUBY/htdocs/RUBY') VRM(*V200) PORT(2202)

Nous avons donc fait notre propre version

rails generate model Producteur code:integer nom:string tel:string appellation:string
                                               nbvin:integer encave:string cepage:string nbcepage:integer

puis

rake db:migrate
/PowerRuby/prV2R0M0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtim
== CreateProducteurs: migrating ============================================
-- create_table(:producteurs)
-> 0.8304s
== CreateProducteurs: migrated (0.8306s) ===================================

la table est créé, enfin :

rails g scaffold_controller Producteur code:integer nom:string tel:string appellation:string
                                                      nbvin:integer encave:string cepage:string nbcepage:integer

/PowerRuby/prV2R0M0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime...
[1m [32m create [0m app/controllers/producteurs_controller.rb
[1m [37m invoke [0m erb
[1m [32m create [0m app/views/producteurs
[1m [32m create [0m app/views/producteurs/index.html.erb
... / ....

le code est généré, Il faut pour terminer, ajouter une route dans routes.rb

resources :producteurs

Puis nous avons modifié quelques libellés dans les fichiers générés (.erb dans app/views/producteurs)

  -> index.html.erb, edit.html.erb, show.html.erb, new.html.erb

Voyez en plus ici : http://iprodeveloper.com/application-development/discover-power-rails-ibm-i