Ruby undefined method `strftime' for nil:NilClass

First you have to make sure if there is 'request_date' filled before you create a record by applying ActiveRecord validations.

Secondly, you can use ruby's try method to avoid such exceptions

<%= @vacationrequest.try(:request_date).try(:strftime, '%B %e, %Y') %>

Happy Coding !

Update

In the newer version of Ruby, you can use &. -> lonely operator instead of the solution above. It is also called safe navigation operator.

<%= @vacationrequest&.request_date&.strftime('%B %e, %Y') %>

@vacationrequest.request_date is nil, so the record you're looking at is missing the request date. It sounds like you have bad data. In this situation, I'd debug why by:

  1. Dumping the @vacationrequest in the view -- <%= debug @vacationrequest %> (or from your controller: fail @vacationrequest.inspect).
  2. Checking in Rails console (rails c) -- what does Vactionrequest.find(some_id) yield?
  3. Optionally, checking the DB entry.

However you're inputting vacation requests is not saving request dates, so there's probably a bug in your create controller action, model schema, or model validation.