Hi all,
I have problem about HAML rendring
I have following small test for haml rendering
a = Coupon.first
=> #<Coupon id: 16, template_id: 1, business_id: 2, tag_line: “Tagline”,
expirat
ion_date: “2009-07-21”, disclaimer: “Disclaimer”, estimated_value:
#<BigDecimal:
67e1f0c,‘0.123E3’,4(12)>, created_at: “2009-07-22 13:56:31”, updated_at:
“2009-0
7-22 13:56:31”, tag_line_font_style: “bold”, tag_line_font_family:
“Arial”, tag_
line_font_size: 22, discount: "50% ", discount_font_style: “bold”,
discount_font
family: “Arial”, discount_font_size: 22, product_or_service:
“Product/Service”,
product_or_service_font_style: false, product_or_service_font_family:
“Arial”,
product_or_service_font_size: 22, expiration_date_font_style: false,
expiration
date_font_family: “Arial”, expiration_date_font_size: 22, text_color:
“white”, b
ackground_color: “#201E9F”>
if i give following to console
haml_engine = Haml::Engine.new("%h3 Avatar =image_tag( Photo.find(t.busines
s.avatar_id).public_filename(:thumb), :width =>‘80px’, :height =>
‘80px’)").rend
er(Object.new, :t => a)
IT GIVES ---->
=> “
Avatar =image_tag(
Photo.find(t.business.avatar_id).public_filename(:th
umb), :width =>‘80px’, :height => ‘80px’)
\n”
BUT IF I GIVE
haml_engine = Haml::Engine.new("=image_tag( Photo.find(t.business.avatar_id).
public_filename(:thumb), :width =>‘80px’, :height =>
‘80px’)").render(Object.new
, :t => a)
I got following error
NoMethodError: undefined method image_tag' for #<Object:0x6ab04a4> from (haml):1:in
render’
from
c:/ruby/lib/ruby/gems/1.8/gems/haml-2.2.1/lib/haml/engine.rb:167:in
render' from c:/ruby/lib/ruby/gems/1.8/gems/haml-2.2.1/lib/haml/engine.rb:167:in
instance_eval’
from
c:/ruby/lib/ruby/gems/1.8/gems/haml-2.2.1/lib/haml/engine.rb:167:in
`render’
from (irb):8
from :0
Why the image_tag is not executing here?
How to solve this problem? Please give me solution.
Thanks,
Vikas