开发者

Image links in embedded Ruby

I'm a little confused.

How would I go about producing this in embedded ruby?

< a id="example" href="image_tag thing.photo.url" >< img alt="example3" src="image_tag thing.photo.url(:small开发者_如何转开发)" />< /a >


When you need to link a set of objects, rather than calling link_to name, path, options you can use a block, so you're sending in the method(s) you want it to execute. Use the "do" syntax:

<%= link_to thing.photo.url, :id=>'example' do
      image_tag(thing.photo.url(:small), :alt=>"example3")
    end
%>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜