PageRenderTime 24ms CodeModel.GetById 19ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/index.rb

https://code.google.com/
Ruby | 33 lines | 24 code | 6 blank | 3 comment | 1 complexity | 37cea838f33d09fea5111ad7fece68f3 MD5 | raw file
 1require 'sinatra'
 2require 'mysql'
 3#require 'config.rb'
 4require 'active_record'
 5#require 'CarteFidelite.rb'
 6
 7
 8ActiveRecord::Base.establish_connection(:adapter => "mysql",
 9                                        :database => "xl",
10                                        :host => "localhost",
11                                        :user => "root",
12                                        :password => "1A362B9B")
13
14class CarteFidelite  < ActiveRecord::Base
15
16end
17
18get '/' do
19  if !request.GET['createcf'].nil?
20    "youpi #{request.GET['createcf']}"
21  else
22    result = CarteFidelite.all;
23#    result.inspect
24    "mouahaha: #{result.length}"
25    result.each do |x|
26      "voila   #{x.inspect}"
27    end
28  end
29end
30
31def printResult(res)
32  "et hop #{res.nom}"
33end