Does anyone know of an easy way to convert a unique '@username' (i.e.
@user.username) using an auto_link-esque helper? I have a method for
doing it on the way in to the database but, I realise there's a few deal
breakers with that, such as changing the original character length of
whatever was posted (by inserting a href).

Would it be possible to patch auto_link (which I'm already using) to
work with an @username conversion? I was thinking something along these
lines;

     # File actionpack/lib/action_view/helpers/text_helper.rb, line 307
307:       def auto_link(text, link = :all, href_options = {}, &block)
308:         return '' if text.blank?
309:         case link
310:           when :all             then
auto_link_email_addresses(auto_link_urls(text, href_options, &block),
&block)
311:           when :email_addresses then
auto_link_email_addresses(text, &block)
312:           when :urls            then auto_link_urls(text,
href_options, &block)
###:           when :usernames       then auto_link_usernames(text,
href_options, &block)
313:         end
314:       end

I haven't done any patching or delving in to Rails internals before so I
don't how tricky the auto_link_usernames method would be, or, if there's
a better way. Any suggestions?
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to