Created
June 7, 2009 04:03
-
-
Save logankoester/125138 to your computer and use it in GitHub Desktop.
Useful for implementing the html_options hash argument on non-rails erb helpers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hash | |
def to_html_attrs | |
# Useful for implementing the html_options hash argument on non-rails erb helpers | |
attrs = Array.new | |
self.each_pair {|k,v| attrs.push "#{k}=\"#{v}\""} | |
return attrs.join " " | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment