On Sat, Dec 27, 2008 at 4:44 PM, Jeremy Weiskotten <[email protected]> wrote: > > bingo bob wrote: > >> How do I display twelve of em...I know this is uber easy but I can't get >> it to work. >> >> I firgure something like what follows is useful but I cant get the loop >> within the loop working in the view. >> >> <% >> start = Time.now.month >> finish = Time.now.month + 12 >> %> > > Yeah, that's not going to work. The easiest way is probably something > like this: > > <% d = Date.today %> > <% 12.times do %> > > <%= calendar(:year => d.year, :month => d.month) do |d| > if @BookedDays.include?(d) > [d.mday, {:class => "specialDay"}] > else > [d.mday, {:class => "normalDay"}] > end > end > %> > > <% d >>= 1 # advance 1 month %> > <% end %>
Small critique here on your code style. @BookedDays doesn't really follow Ruby on Rails conventions. Camel-case should only be used by class/module definitions and references. @booked_days is the convention that Rails encourages. This might be something that you've decided based on a personal or team preference, but in case you're not attached to it, following Rails conventions will make your life and anybody else that later works on a project.. a little easier. :-) Cheers, Robby -- Robby Russell Chief Evangelist, Partner PLANET ARGON, LLC design // development // hosting w/Ruby on Rails http://www.planetargon.com/ http://www.robbyonrails.com/ aim: planetargon +1 503 445 2457 +1 877 55 ARGON [toll free] +1 815 642 4068 [fax] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

