Well, I'm sure experienced veterinarians already know this, but as a rookie I had to figure this long way out ... let me see if I can explain this without stuffing it.
Although I did not save the user_profile object directly, I noticed in my logs that something was updating the last_activity_time user model (and user_profile model) every time I submitted the form (the date of the last user model was also updated when registering, the user also had different things - later I realized that it was installed in the configuration of the Witchcraft gem).
Per http://api.rubyonrails.org/classes/ActiveRecord/AutosaveAssociation.html AutosaveAssociation is a module that takes care of automatically saving related records when their parent is saved. In my case, user mode is the parent, and the scenario below reflects my experience.
class Post has_one :author, :autosave => true end post = Post.find(1) post.title # => "The current global position of migrating ducks" post.author.name # => "alloy" post.title = "On the migration of ducks" post.author.name = "Eloy Duran" post.save post.reload post.title # => "On the migration of ducks" post.author.name # => "Eloy Duran"
The following solutions solved my problem: 1. Stopping Magic (configuring) from updating users last_activity_time (for each action) or 2. Passing the option :: autosave => false when I set the association in the user model as follows
class User < ActiveRecord::Base has_one :user_profile, :autosave => false end
source share