ruby on rails - How to convert an a tag into a link_to tag -
how turn following pinterest tag rails link_to tag create link dynamically
<a href="//www.pinterest.com/pin/create/button/?url=http%3a%2f%2fwww.flickr.com%2fphotos%2fkentbrew%2f6851755809%2f&media=http%3a%2f%2ffarm8.staticflickr.com%2f7027%2f6851755809_df5b2051c9_z.jpg&description=next%20stop%3a%20pinterest" data-pin-do="buttonpin" data-pin-config="none"></a>
url = "//www.pinterest.com/pin/create/button/?url=http%3a%2f%2fwww.flickr.com%2fphotos%2fkentbrew%2f6851755809%2f&media=http%3a%2f%2ffarm8.staticflickr.com%2f7027%2f6851755809_df5b2051c9_z.jpg&description=next%20stop%3a%20pinterest" link_to "pinterest", url, { data: { pin_do: "buttonpin", pin_config: "none"} }
note need put quotes around 'pin-do' , 'pin-config' because of dashes. update: @stefan, i've learned rails automatically converts underscores hyphens in data tags.
reference:
Comments
Post a Comment