Hey dudes,
i’m trying to build a small calendar into my app. I follow the steps
shown in #213 Calendars - RailsCasts, so i go with the
table_builder gem, which allows to use the calendar_for command. But
unfortunately it doesnt work or rather show the results in my
view-template. I even got no error-message.
It only shows this: (twice!!?!)
Calendar
< March 2011 >
Ok here’s my Code (btw. i use Rails 3.0.4 and 1.8.7-p330):
Controller:
class MycalendarController < ApplicationController
def month
@visitors = Visitor.all
@date = params[:month] ? Date.parse(params[:month]) : Date.today
end
end
View:
Calendar
<%= link_to "<", :month => (@date.beginning_of_month-1).strftime("%Y/%m") %> <%=h @date.strftime("%B %Y") %> <%= link_to ">", :month => (@date.end_of_month+1).strftime("%Y/%m") %>
<% calendar_for(@visitors, :year => @date.year, :month => @date.month) do |calendar| %> <%= calendar.head('Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag','Freitag','Samstag') %> <% calendar.day(:day_method => :datum) do |date, visitors| %> <%= date.day %>-
<% for visitor in visitors%>
- <%= link_to (visitor.name), :controller => 'visitor' %> <% end %>
I hope u can help me out of this misery.
Thanks in advance for any suggestions.
Regards, Andreas