From the Agile book, page 144 regarding a div tag helper

Hi. in the Rails Agile book here’s what was happening:

module StoreHelper
def hidden_div_if(condition, attributes = {})
if condition
attributes[“style” ] = “display: none”
end
attrs = tag_options(attributes.stringify_keys)
“<div #{attrs}>”
end

format_price method …

end

Note that we cheated slightly here. We copied code from the Rails
standard
helper called content_tag( ); thatâ??s how we knew to call tag_options( )
the way
we did.And how did we find the source code of the content_tag( ) method?
We brought up the
RDoc documentation in a browser and clicked the View Source link.

This just flew gracefully over my head…(duuugh)…

I was at the RDDoc site, and nothing pertaining to helper methods, or a
source containing ‘content_tag()’ was found…

So my question is which source file did Dave talk about? and how often
would we have to do this kind of trick…

Thanks

It’s a listed method on the main page.
http://api.rubyonrails.com/classes/ActionView/Helpers/
TagHelper.html#M000489

        - dan


Dan K. mailto:[email protected]
http://www.dankohn.com/ tel:+1-415-233-1000

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs