File column within link_to


#1

Hi,
I correctly see:
image_tag url_for_file_column(“element”, “picture_url”, “medium”)
now I need to make it a link so I’ve used:
<%= link_to(image_tag url_for_file_column(“element”, “picture_url”,
“medium”), {:controller => “products”, :action => “sec_level”,
:level_id => @element.id}) unless @element.picture_url.nil? %>
but what I get is a link to the action that has rendered the current
view…
Enrico


“The only thing necessary for the triumph of evil
is for good men to do nothing”
Edmund Burke


#2

it works fine, there’s just a bracket typo:
<%= link_to(image_tag(url_for_file_column(“element”, “picture_url”,
“medium”)), {:controller => “products”, :action => “sec_level”,
:level_id =>
@element.id}) unless @element.picture_url.nil? -%>
instead of:

<%= link_to(image_tag(url_for_file_column(“element”, “picture_url”,
“medium”))), {:controller => “products”, :action => “sec_level”, :level_id =>
@element.id} unless @element.picture_url.nil? -%>

thank you Dave :slight_smile:


“The only thing necessary for the triumph of evil
is for good men to do nothing”
Edmund Burke


#3

On Friday 10 Feb 2006 08:27, Enrico T. wrote:

now I need to make it a link so I’ve used:
<%= link_to(image_tag url_for_file_column(“element”, “picture_url”,
“medium”), {:controller => “products”, :action => “sec_level”,
:level_id => @element.id}) unless @element.picture_url.nil? %>
but what I get is a link to the action that has rendered the current
view…

Untested, but try:

<%= link_to(image_tag(url_for_file_column(“element”, “picture_url”,
“medium”))), {:controller => “products”, :action => “sec_level”,
:level_id =>
@element.id} unless @element.picture_url.nil? -%>

I think you just had your brackets in a twist - you should have had one
more
after “medium” although I’ve added two since I put one between image_tag
and
url_for_file_column too.

Hope that works!

~Dave

Dave S.
Rent-A-Monkey Website Development
http://www.rentamonkey.com/

PGP Key: http://www.rentamonkey.com/pgpkey.asc