SOLVED - Re: [Rails] ActionView::Helpers::TextHelper - auto_link

15 views
Skip to first unread message

Samantha

unread,
Apr 1, 2007, 12:45:20 PM4/1/07
to Ruby on Rails: Talk


On 3/25/07, Samantha <rubyge...@gmail.com> wrote:

Hi there,

I'm working on something in Rails (my first app, really) and
attempting to use the auto_link feature.  Basically, one of the fields
in my database is a url.  I have successfully gotten it to format in
the view with the auto_link helper, but when it comes time for me to
try and input the :target => '_blank' part of things, it craps out on
me.

This is the code that works:

<td><%= auto_link(h link.send(column.name)) %></td>

When I attempt to have it use the :target => '_blank' stuff, is where
I'm getting lost...

If I change it to this: (or several other syntax variations)

<td><%= auto_link(h link.send(column.name), :target => '_blank') %></
td>

I get this:

wrong number of arguments (2 for 1)
Extracted source (around line #13):
10: <% for link in @links %>
11:   <tr>
12:   <% for column in Link.content_columns %>
13:     <td><%= auto_link(h link.send(column.name), :target =>
'_blank') %></td>
14:   <% end %>
15:     <td><%= link_to 'Show', :action => 'show', :id => link %></td>
16:     <td><%= link_to 'Edit', :action => 'edit', :id => link %></td>

I've looked here:  http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html

I'm pretty sure it's probably something glaringly obvious that I'm
missing, but rather than bang my head incessantly on my keyboard, I
figured I'd save myself the qwerty imprints on my forehead and
ask.  :)

Thanks,
Samantha

--
http://www.babygeek.org


After playing with it more, this is the proper usage... just in case anyone out there had issues getting it to work, too:
<%= auto_link(h(link.send( column.name)), :all, :target => '_blank') %>


--
Samantha

http://www.babygeek.org/

"Beware when the great God lets loose a thinker on this planet. Then all things are at risk."
  --Ralph Waldo Emerson
Reply all
Reply to author
Forward
0 new messages