From: Roelof Wobben Date: 2012-10-13T20:35:08+09:00 Subject: multiple array problem --_772d6683-00d7-45eb-9ab8-c32801b3c657_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello=2C Suppose I have 3 arrays with content. The content are articles of= that category.Now I want 1 of the 3 arrays displayed and the other 2 not.W= hich array depends on the content. Now I can make 3 times this code. categ= ory1.article.each do |artikel| puts article.nameend category2.article.ea= ch do |artikel| puts article.nameend category3.article.each do |artikel|= puts article.nameend But now I have 3 parts of code which are almost th= e same.Is there a way I can make 1 part of code where the category is a var= iable. Roelof = --_772d6683-00d7-45eb-9ab8-c32801b3c657_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello=2C
 =3B
Suppose I have 3 arrays with content. The content = are articles of that category.
Now I want 1 of the 3 arrays displayed an= d the other 2 not.
Which array depends on the content.
 =3B
No= w I can make 3 times this code.
 =3B
category1.article.each do |= artikel|
 =3B =3B =3B puts article.name
end
 =3Bcategory2.article.each do |artikel|
puts article.name
end
&n= bsp=3B
category3.article.each do |artikel|
puts article.name
e= nd
 =3B
But now I have 3 parts of code which are almost the same.=
Is there a way I can make 1 part of code where the category is a variab= le.
 =3B
Roelof
 =3B
= --_772d6683-00d7-45eb-9ab8-c32801b3c657_--