What am I missing here, trying to get the event_calendar plugin working with my existing app. Have installed the plugin, which I guess is a good start, then this... class Booking < ActiveRecord::Base has_event_calendar :start_at_field => ''arrival_date'', :end_at_field => ''departure_date'' Route... map.availability_calendar ''/availability_calendar/:year/:month'', :controller => ''properties'', :action => ''availability_calendar'', :requirements => {:year => /\d{4}/, :month => /\d{1,2}/}, :year => nil, :month => nil Action in controller.... def availability_calendar @month = (params[:month] || Time.zone.now.month).to_i @year = (params[:year] || Time.zone.now.year).to_i @shown_month = Date.civil(@year, @month) @event_strips = Booking.event_strips_for_month(@shown_month) end View ..... foo <%= event_calendar %> Result.... undefined local variable or method `event_calendar'' for #<ActionView::Base:0x102e77220> -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Interestingly if I change this... class Booking < ActiveRecord::Base has_event_calendar :start_at_field => ''arrival_date'', :end_at_field => ''departure_date'' to simply has_event_calendar I get this error... Mysql::Error: Unknown column ''end_at'' in ''where clause'': SELECT * FROM `bookings` WHERE ((''2010-10-30 23:00:00'' <= end_at) AND (start_at< ''2010-12-05 00:00:00'')) ORDER BY start_at ASC Which suggests the plugin is working it just doesn''t like my customised start and end syntax? -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hmm, thinking out load here - I just created a fresh test app with just the plugin and it worked. dates are all of type DATETIME. My dates of of type DATE - maybe that''s the problem. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ignore me. I needed a helper like this.. All good - :-), it looks Great. module CalendarHelper def month_link(month_date) link_to(I18n.localize(month_date, :format => "%B"), {:month => month_date.month, :year => month_date.year}) end # custom options for this calendar def event_calendar_opts { :year => @year, :month => @month, :event_strips => @event_strips, :month_name_text => I18n.localize(@shown_month, :format => "%B %Y"), :previous_month_text => "<< " + month_link(@shown_month.last_month), :next_month_text => month_link(@shown_month.next_month) + " >>" } end def event_calendar # args is an argument hash containing :event, :day, and :options calendar event_calendar_opts do |args| event = args[:event] %(<a href="/events/#{event.id}" title="#{h(event.name)}">#{h(event.name)}</a>) end end end -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.