Frederick Cheung wrote: > On Oct 13, 10:14�am, Neil Cauldwell <[EMAIL PROTECTED]> > wrote: >> 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; > > You certainly could (personally I'd probably alias_method_chain it > just to add your auto_link_usernames behaviour. > I'd also worry about getting the scanning text for usernames bit right > first before wiring it into auto_link > > Fred
Thanks Fred. I do have the scanning working just fine on the way in to the database but, the problem is that auto_link doesn't 'auto link' links preceded with @ - if it did, I would already have a working solution (at least, if I was happy with the conversion being done on the way in to the database). Either way, considering what needs to happen in this particular application, the conversion is better-off being done in the view and probably in tandem with auto_link (seeing as auto_link already does the job just fine on '@comment.body' - with everything but @usernames). I know little about alias_method_chain - am I right in presuming that it allows behavior to be added without 'overwriting' a method? Where would the alias_method_chain live? Also, a little OT; I came across a link to your company site a little while back and realised you're based in Cambridge (IIRC). Do you get to (or know of?) many Rails/web app meet-ups? I'm in lovely Stratford-Upon-Avon. There doesn't appear to be much in the way of meet-ups around here. -- 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 [email protected] 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 -~----------~----~----~----~------~----~------~--~---

