开发者

Rails 3 create a link to image_url and show image_url(:medium)

I am trying to create a link to an image @user.image_url. This wil开发者_开发百科l be the full sized image. I want the medium resized image to be shown @user.image_url(:medium). But what I also want is for the @user.image_url to open in FancyBox.

My current code at the moment is:

<%= link_to image_tag @user.image_url(:medium), :style => "width:717px;height:409px" %>

This links to the Users profile page, which is what I don't want.

Please help :)


Use brackets for nesting methods

<%= link_to image_tag( @user.image_url(:medium), :style => "width:717px;height:409px"), @user.image_url %>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜