I am have a instance variable ride
that comes from a table and it has a column ride.pickup_at
If I do <%= ride.pickup_at.class.name %>
I get
time
So Strftime should be available.
Now, if I do <%= ride.pickup_at.strftime('%x') %>
I get an error
undefined method `strftime' for nil:NilClass
What do I have to do to make strftime available?
you can use try
to do the nil
judge: <%= ride.pickup_at.try(:strftime, '%x') %>
.Or I think you should figure out what to do if ride.pickup_at
is nil