Content_tag can not work?


#1

the tag helper “content_tag” can not work correnctedly on my enviroment:
page.insert_html :bottom, ‘body’, content_tag(“div”,“id”=>“tag”)

then in body,i can only get “idtag” as the text!

but if i use : content_tag(“p”,“hello world”)
I can get it worked. From the rails 1.1 api document,i can find the
example of using content_tag in the former way,what is the matter with
that? Or i have made some mistakes?


#2

Charlie wrote:

the tag helper “content_tag” can not work correnctedly on my enviroment:
page.insert_html :bottom, ‘body’, content_tag(“div”,“id”=>“tag”)

then in body,i can only get “idtag” as the text!

but if i use : content_tag(“p”,“hello world”)
I can get it worked. From the rails 1.1 api document,i can find the
example of using content_tag in the former way,what is the matter with
that? Or i have made some mistakes?

content_tag requires that you specify some content as the second
parameter. To create an empty div with id tag, use

content_tag(“div”, “”, “id”=>“tag”)

Alternatively, you can use the tag helper method:

tag(“div”, “id”=>“tag”)


Philip R.
http://tzinfo.rubyforge.org/ – DST-aware timezone library for Ruby