RailsCasts Pro episodes are now free!

Learn more or hide this

Jason Garber's Profile

GitHub User: jgarber

Site: http://twitter.com/jasongarber

Comments by Jason Garber

Avatar

If you're getting an endless loop of updating, change to:

  def reprocess_photo
    photo.assign(photo)
    photo.save
  end
Avatar

One bug to watch out for is selecting a country and state, saving, and then changing it to a country that has no states. The old state will still persist on the object because the state select was emptied, so no value will be POSTed/PUT for state. You can either do .html($("<option>").attr('selected',true)) instead of empty() or you can have a hidden field with the same name, like Rails does for checkboxes.