On Mon, Feb 24, 2014 at 7:35 AM, Роман Ярыгин <330...@gmail.com> wrote:

> Please, help me to DRY this code snippet. The task is to print div content,
> but to print it in div, when i%17 ==0 and make it without div, when not.

A view helper method would do the trick.  Make one that returns the
bit that stays the same (the link_to, strong, comma, and server
address), then call it where you have those things.

Or you could use a decorator that contains the logic of looking at i.

-Dave

-- 
Dave Aronson, the T. Rex of Codosaurus LLC (www.codosaur.us);
FREELANCE SOFTWARE DEVELOPER, AVAILABLE AS OF MARCH 1st 2014;
creator of Pull Request Roulette, at PullRequestRoulette.com.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAHxKQigHXzD%2BZ%2BH-0LCKkYS5-GwUiAv4xPadywhTucJkpo2F-A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to