51224bdd17878b3b19e8987e9bb336a2

Hi,
- I have @tags instance variable which contents different tags.
- I want to display those tags with links and comma separated.

Thanks
DG

1
2
3
4
5
6
 @tags = ["Science","Tools","Physics"]

 output should be

 Science,Tools,Physics   (with links)

Refactorings

No refactoring yet !

B107d8b1f213ff3af634ee6ecf7720cc

bakkdoor

August 19, 2008, August 19, 2008 15:44, permalink

1 rating. Login to rate!

something like this?

1
2
3
def link_to_tags(tags)
  tags.collect { |tag| link_to tag, tags_path_for(tag) }.join(",")
end
F288a8afe5302a16a366d5e9d34f2fec

Joe Grossberg

August 19, 2008, August 19, 2008 20:36, permalink

1 rating. Login to rate!

What does this have to do refactoring? You didn't even post any code. It looks like you're asking other people to figure out the problem for you, rather than improve upon a solution you already came up with.

Your refactoring





Format Copy from initial code

or Cancel