I have a virtual attribute that takes natural language dates and sanitizes it to a proper date time field to store in the db. I then have a getter that changes the raw datetime to a nicely formatted on.
# Getter for easy way to get nice date
def natural_due_date
due_date.strftime('%d/%m/%Y') if due_date
end
# Setter to convert nice date to db save-able date format
def natural_due_date=(date)
self.due_date = Chronic.parse(date) if date.present?
end
When using best in place I can update the field but it doesnt automatically bring back the new value I have to refresh the page to see the changes.
Is this a limitation of the gem or am I missing something?
I have a virtual attribute that takes natural language dates and sanitizes it to a proper date time field to store in the db. I then have a getter that changes the raw datetime to a nicely formatted on.
When using best in place I can update the field but it doesnt automatically bring back the new value I have to refresh the page to see the changes.
Is this a limitation of the gem or am I missing something?