Hey dudes,
i'm trying to build a small calendar into my app. I follow the steps
shown in http://railscasts.com/episodes/213-calendars, 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 >
<th>Sonntag</th><th>Montag</th><th>Dienstag</th><th>Mittwoch</th><th>Donnerstag</th><th>Freitag</th><th>Samstag</th><th>Sonntag</th><th>Montag</th><th>Dienstag</th><th>Mittwoch</th><th>Donnerstag</th><th>Freitag</th><th>Samstag</th>
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:
------------
<h1>Calendar</h1>
<div id="calendar">
<h2 id="month">
<%= 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")
%>
</h2>
<% 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 %>
<ul>
<% for visitor in visitors%>
<li><%= link_to (visitor.name), :controller => 'visitor'
%></li>
<% end %>
</ul>
<% end %>
<% end %>
</div>
-----------------
I hope u can help me out of this misery.
Thanks in advance for any suggestions.
Regards, Andreas
--
Posted via http://www.ruby-forum.com/.
--
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.