使用“weekly_builder”在我的日历中出现错误插件
我建立了一个每周日历“weekly_builder”( https://github.com/dmix/weekly_builder/ )我在 http://dmix.ca/2009/06/weeklybuilder-a-weekly-calendar-plugin-for-rails/ 。 当我进入日历路线时,我收到此错误:
undefined method `starts_at' for #<Status:0x866c100>
Extracted source (around line #4):
1:
2: <% weekly_links(:date => @date) %>
3: <% weekly_calendar(@events, :date => @date, :include_24_hours => true) do |w| %>
4: <% w.week(:business_hours => params[:business_hours], :clickable_hours => true) do |event,truncate| %>
5: <%= event.date.strftime('%I:%M%p') %>
6: <%= link_to truncate(event.name,truncate), event_path(event) %>
7: <% end %>
这是我的日历控制器:
def weekcalendar
@date = Time.parse("#{params[:start_date]} || #{Time.now.utc}")
@start_date = Date.new(@date.year, @date.month, @date.day)
@events = Status.find(:all, :conditions => ['date between ? and ?', @start_date,
@start_date + 7])
end
这是我的日历视图:
<% weekly_links(:date => @date) %>
<% weekly_calendar(@events, :date => @date, :include_24_hours => true) do |w| %>
<% w.week(:business_hours => params[:business_hours], :clickable_hours => true) do |event,truncate| %>
<%= event.date.strftime('%I:%M%p') %>
<%= link_to truncate(event.name,truncate), event_path(event) %>
<% end %>
<% end %>
请让我知道出了什么问题。 非常感谢。
i builed a weekly calendar "weekly_builder" ( https://github.com/dmix/weekly_builder/ ) that i found in http://dmix.ca/2009/06/weeklybuilder-a-weekly-calendar-plugin-for-rails/ .
when i go into the calendar route i get this error:
undefined method `starts_at' for #<Status:0x866c100>
Extracted source (around line #4):
1:
2: <% weekly_links(:date => @date) %>
3: <% weekly_calendar(@events, :date => @date, :include_24_hours => true) do |w| %>
4: <% w.week(:business_hours => params[:business_hours], :clickable_hours => true) do |event,truncate| %>
5: <%= event.date.strftime('%I:%M%p') %>
6: <%= link_to truncate(event.name,truncate), event_path(event) %>
7: <% end %>
this is my calendar controller:
def weekcalendar
@date = Time.parse("#{params[:start_date]} || #{Time.now.utc}")
@start_date = Date.new(@date.year, @date.month, @date.day)
@events = Status.find(:all, :conditions => ['date between ? and ?', @start_date,
@start_date + 7])
end
and this is my calendar view:
<% weekly_links(:date => @date) %>
<% weekly_calendar(@events, :date => @date, :include_24_hours => true) do |w| %>
<% w.week(:business_hours => params[:business_hours], :clickable_hours => true) do |event,truncate| %>
<%= event.date.strftime('%I:%M%p') %>
<%= link_to truncate(event.name,truncate), event_path(event) %>
<% end %>
<% end %>
please let me know what is wrong.
thank you very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您为
Status
模型定义了starts_at
属性。根据您收到的错误,没有定义
starts_at
。将您使用的任何属性的名称更改为starts_at
,或者在 Status 模型中定义一个别名方法。或者
或者查看您使用的插件是否有一些配置参数来指定不同的字段。
Make sure you have a
starts_at
attribute defined for yourStatus
model.According to the error you are getting, there is not
starts_at
defined. Either change the name of whatever attribute you are using tostarts_at
, or in your Status model, define an alias method.or
Or see if there is some configuration parameter with the plugin you are using to specify a different field.