-2
-#encoding: utf-8
:css
 .hidden{display:none;}
%script{:src=>"/javascripts/jquery.js"}
%form{:action=>"https://get724.ccvb.com.tr/Get724/get724uye.aspx",:method=>"post"}
 %input.hidden{:type=>"text",:name=>"uyeno",:value=>""}
 %input.hidden{:type=>"text",:name=>"kkno",:value=>""}
 %input.hidden{:type=>"text",:name=>"gectar",:value=>""}
 %input.hidden{:type=>"text",:name=>"tutar",:value=>""}
 %input.hidden{:type=>"text",:name=>"dcins",:value=>""}
 %input.hidden{:type=>"text",:name=>"sipbil",:value=>""}
 %input.hidden{:type=>"text",:name=>"sesbil",:value=>""}
 %input.hidden{:type=>"text",:name=>"burl",:value=>""}
 %input.hidden{:type=>"text",:name=>"hurl",:value=>""}
 - t = Time.now.strftime("%Y%m%d%H%M%S")
 - puts t
 %input.hidden{:type=>"text",:name=>"zaman",:value=>"#{t}"}
 -puts "adfasdf : " + @asdf.to_s
 -puts "asdf"
 -puts "asdf : " + @asdf.to_s
 -puts session[:ewer]
 -puts session[:zxcv]
 -puts strtodigest
 -digest = Digest::SHA1.base64digest(strtodigest)
 -puts digest
 -#%input{:type=>"text",:value=>"#{strtodigest}"}
 -#%input{:type=>"text",:value=>"#{digest}"}
 %input.hidden{:type=>"text",:name=>"ozet",:value=>"#{digest}"}
:javascript
  $('form').submit();
-puts "End Of Haml"

I have a haml like above and i am using it in a Sinatra application. When i run my app

haml :problem_haml

Every single ruby command works perfectly, but haml does not render anything. Not even a single line, yet every ruby command starts with "-" works absolutely perfect? What could be the cause? Please do not answer "because hidden class hides everything", it is not about css hiding, literally not even a single byte returns from server.

Edit:

I said the application is a sinatra application before, but it is actually a Padrino application. While padrino is only a few sinatra applications that run inside a main sinatra application and more people knows sinatra, i said sinatra to make the question simpler.

Also here is the code that calls haml,

def get3DSecure(ccname,price,skul,ccno,cvc)
    puts "#############################################"
    puts "get3DSecure function called"
    puts "#############################################"
    @ccname = ccname
    @price = price.to_s + "00"
    @skul = skul
    @ccno = ccno
    @cvc = cvc
    session[:name] = ccname
    session[:xmltosend] = makeXmlFor3D
    session[:sipbil] = UUIDTools::UUID.random_create.to_s.delete!("-")
    session[:sesbil] = UUIDTools::UUID.random_create.to_s.delete!("-")
    session[:skul] = skul
    session[:price] = price
    session[:ccno] = ccno
    session[:cvc] = cvc
    puts "#############################################"
    puts "get3DSecure function near end, render starts"
    puts "#############################################"
    render :adsecure,:layout=>:main
  end

It also writes the puts commands to console without any problems.

gkaykck
  • 2,347
  • 10
  • 35
  • 52
  • The HTML that will be generated by the Haml here will not show up in the browser. You say “not even a single byte returns from server” – are you sure? If that is the case then this likely isn’t a Haml issue. Can you see the HTML if you view source in your browser. Note that using `puts` will write to stdout (likely to the terminal), _not_ to your HTML page. – matt Sep 20 '12 at 22:23
  • yes i am sure, nothing returns, just an empty page(source). – gkaykck Sep 22 '12 at 14:12

4 Answers4

2

Your code works for me, although first I got:

WARN: tilt autoloading 'haml' in a non thread-safe way; explicit require 'haml' suggested.

Because I forgot to add:

require "haml" 

At the beginning of my code. Could it be your problem?

Christian Teijon
  • 456
  • 4
  • 12
1

I have find out that render or haml methods does not do return. So if you are in middle of your function, your should do

return haml :problem_haml

It fixes the problem.

gkaykck
  • 2,347
  • 10
  • 35
  • 52
-1

You may check if your form is submitted, using chrome developer tools, firebug or something like (check POST), and if it is, as there is a post request you need to handle the response, just a guess :)

kfl62
  • 2,434
  • 4
  • 29
  • 40
-1

pay attention while you are using puts inside haml/slim/erb templates, this because haml has it's own puts method: http://haml.info/docs/yardoc/Haml/Exec/Generic.html#puts-instance_method

so, since you are using padrino, replace every puts with: logger.debug

DAddYE
  • 1,719
  • 11
  • 16