Forum: Ruby on Rails file column within link_to

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.
6992e8171ed4afa8b4ad4a8cef31fa29?d=identicon&s=25 Enrico Teotti (Guest)
on 2006-02-10 09:28
(Received via mailing list)
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
Cf7e5e4b5ca573eec214191fac420a2f?d=identicon&s=25 Dave Silvester (Guest)
on 2006-02-10 21:38
(Received via mailing list)
On Friday 10 Feb 2006 08:27, Enrico Teotti 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 Silvester
Rent-A-Monkey Website Development
http://www.rentamonkey.com/

PGP Key: http://www.rentamonkey.com/pgpkey.asc
6992e8171ed4afa8b4ad4a8cef31fa29?d=identicon&s=25 Enrico Teotti (Guest)
on 2006-02-13 11:37
(Received via mailing list)
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 :)



--
"The only thing necessary for the triumph of evil
is for good men to do nothing"
 Edmund Burke
This topic is locked and can not be replied to.