title: Rails 3.2: undefined method `strftime' for nil:NilClass
body: <p>Getting the following error when implementing <a href="https://github.com/watu/table_builder" rel="nofollow">this</a> calendar gem.</p>
  
  <pre><code>NoMethodError in Users#show
  
  Showing /Users/nelsonkeating/Desktop/ReminDeal/app/views/users/show.html.erb where line #66 raised:
  
  undefined method `strftime' for nil:NilClass
  Extracted source (around line #66):
  
  63:   &lt;/h2&gt;
  64:                 &lt;%= calendar_for @friends, :year =&gt; @date.year, :month =&gt; @date.month do |calendar| %&gt;
  65:                  &lt;%= calendar.head('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun') %&gt;
  66:                   &lt;%= calendar.day(:day_method =&gt; :dob) do |date, friends| %&gt;
  67:                    &lt;%= date.day %&gt;
  68:                     &lt;ul&gt;
  69:                         &lt;% friends.each do |friend| %&gt;
  </code></pre>
  
  <p>users_controller.rb</p>
  
  <pre><code>   class UsersController &lt; ApplicationController
     before_filter :authenticate_user!
  
    def index
      authorize! :index, @user, :message =&gt; 'Not authorized as an administrator.'
      @users = User.paginate(:page =&gt; params[:page])
  
    end
  
    def show
      @user = User.find(params[:id])
      @friends = @user.friends.paginate(page: params[:page])
      @date = params[:month] ? Date.parse(params[:month]) : Date.today
     end
  </code></pre>
  
  <p>users/show.html.erb</p>
  
  <pre><code>&lt;div id="calendar"&gt;
      &lt;h2 id="month"&gt;
      &lt;%= link_to "&lt;", :month =&gt; (@date.beginning_of_month-1).strftime("%Y-%m") %&gt;
      &lt;%=h @date.strftime("%B %Y") %&gt;
      &lt;%= link_to "&gt;", :month =&gt; (@date.end_of_month+1).strftime("%Y-%m") %&gt;
    &lt;/h2&gt;
                  &lt;%= calendar_for @friends, :year =&gt; @date.year, :month =&gt; @date.month do |calendar| %&gt;
                   &lt;%= calendar.head('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun') %&gt;
                    &lt;%= calendar.day(:day_method =&gt; :dob) do |date, friends| %&gt;
                     &lt;%= date.day %&gt;
                      &lt;ul&gt;
                          &lt;% friends.each do |friend| %&gt;
                          &lt;li&gt; &lt;%= link_to h(friend.name), friends %&gt;&lt;/li&gt;
                       &lt;% end %&gt;
                      &lt;/ul&gt;
                  &lt;% end %&gt;
              &lt;% end %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>friend.rb</p>
  
  <pre><code># == Schema Information
  #
  # Table name: friends
  #
  #  id         :integer         not null, primary key
  #  name       :string(255)
  #  dob        :date
  #  gender     :string(255)
  #  user_id    :integer
  #  created_at :datetime        not null
  #  updated_at :datetime        not null
  #  int        :string(255)
  #
  
  class Friend &lt; ActiveRecord::Base
    attr_accessible :name, :dob, :gender, :interests, :int, :interest_ids, :date
    belongs_to :user
    has_many :person_interests, :as =&gt; :person
    has_many :interests, :through =&gt; :person_interests
    serialize :ints
  </code></pre>
  
  <p>end</p>