Cycling through array of objects within view in Rails: unexpected behaviour -


I have found a simple calendar displaying some events, which is not giving me the candidate results Here's the code:

  & lt ;! - Start Calendar - & gt; & Lt;% = Calendar (: year = & gt; @ year, month = & gt; @ month, first_day_of_wiki = gt; 1) what? D | Output = [] output & lt; & Lt; Render_calendar_cell (d.mday) if d.wday == 1 @ garden.plants.collect. P | If p.needs_sowing? (D.cweek) output & lt; & Lt; "Sowing this week: # {p.name}" End End End% & gt; & Lt ;! - End calendar - & gt;  

Need it here? Method called within the block:

  Need DEF? (Week) if! Sow_out_week_min.blank? & Amp; & Amp; ! Sow_out_week_max.blank? (Sow_out_week_min..sow_out_week_max) .include? (Week) End of the end  

This is giving me the correct behavior when the same plant is inspected in the loop, but if there are more than one then no output will be displayed From the initial

Output & lt; & Lt; Render_calendar_cell (d.mday)

(which outputs only on the day of the month).

Can anyone tell me where I am going wrong? Or have some tips got better in processing this type of loop?

TIA

instead of archive > @ Garden.plants.each . Collect the results of the array must be collected to filter.


Comments