RailsCasts Pro episodes are now free!

Learn more or hide this

Masahiro Takahashi's Profile

GitHub User: marknt0053

Comments by Masahiro Takahashi

Avatar

hello,

i'm newbie of rubby an rails.
i'm using ruby version 1.8.7 and rails version 2.3.2.

I just downloaded this sample source code and tried to use.

I got this error

NoMethodError in Articles#index

Showing app/views/articles/index.html.erb where line #12 raised:

You have a nil object when you didn't expect it!
The error occurred while evaluating nil.strftime

Extracted source (around line #12):

9:
10: <% calendar_for @articles, :year => @date.year, :month => @date.month do |calendar| %>
11: <%= calendar.head('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday') %>
12: <% calendar.day(:day_method => :published_on) do |date, articles| %>
13: <%= date.day %>
14:
15: <% for article in articles %>

RAILS_ROOT: /home/markn/myRailsApps/blog
Application Trace | Framework Trace | Full Trace

/home/markn/myRailsApps/blog/vendor/plugins/table_builder/lib/table_builder/calendar_helper.rb:101:in objects_for_days'
/home/markn/myRailsApps/blog/vendor/plugins/table_builder/lib/table_builder/calendar_helper.rb:100:in
each'
/home/markn/myRailsApps/blog/vendor/plugins/table_builder/lib/table_builder/calendar_helper.rb:100:in objects_for_days'
/home/markn/myRailsApps/blog/vendor/plugins/table_builder/lib/table_builder/calendar_helper.rb:27:in
day'
/home/markn/myRailsApps/blog/vendor/plugins/table_builder/lib/table_builder/table_builder.rb:115:in tbody'
/home/markn/myRailsApps/blog/vendor/plugins/table_builder/lib/table_builder/calendar_helper.rb:26:in
day'
/home/markn/myRailsApps/blog/app/views/articles/index.html.erb:12:in _run_erb_app47views47articles47index46html46erb'
/home/markn/myRailsApps/blog/app/views/articles/index.html.erb:10:in >
_run_erb_app47views47articles47index46html46erb'

Request

Parameters:

None

Show session dump
Response

Headers:

{"Cache-Control"=>"no-cache",
"Content-Type"=>"text/html"}`

Does someby have any suggestions?

Thank you.