Forum: Ruby on Rails Rails Helper

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Newb N. (Guest)
on 2009-02-18 06:24
hi..
this is html generated code.
<a href="images/image-1.jpg" rel="lightbox" title="my caption">image
#1</a>

is it possible to use Rails code instead of the above one.
if possible to use Rails helper means which would generate html code
like above
Steve R. (Guest)
on 2009-02-18 06:52
(Received via mailing list)
def link_to_image(image_number, caption)
   link_to("image ##{image_number}", "images/image-
#{image_number}", :rel => 'lightbox', :title => caption)
end

 >> puts link_to_image(3, 'third image')
<a href="images/image-3" rel="lightbox" title="third image">image #3</a>
This topic is locked and can not be replied to.