Wrap text
|
|
# controller
@cal = Calendar::Builder.for(:month).new(:date => params[:date] || Date.today)
posts = Post.find(:all, :conditions => {:created_at => @cal.begin_on.to_time..@cal.end_on.to_time})
@posts_for_calendar = posts.group_by {|p| p.created_at.to_date }
# view
<% calendar do |date| %>
<% if @posts_for_calendar[date] %>
<%= link_to date.day, root_path %>
<% else %>
<%= date.day%>
<% end %>
<% end %>
|