bernat / best_in_place

A RESTful unobtrusive jQuery Inplace-Editor and a helper as a Rails Gem
http://blog.bernatfarrero.com/in-place-editing-with-javascript-jquery-and-rails-3/
1.2k stars 570 forks source link

When using virtual attribute getter and setter field doesnt automatically update #322

Open sammdec opened 10 years ago

sammdec commented 10 years ago

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?

seuros commented 10 years ago

I can't reproduce this error.