# Updating model with has\_one association - do not want to update associated model

**URL:** <https://www.ruby-forum.com/t/updating-model-with-has-one-association-do-not-want-to-update-associated-model/156232>\
**Category:** Rails\
**Created:** [December 23, 2008, 5:15am UTC](https://www.ruby-forum.com/t/updating-model-with-has-one-association-do-not-want-to-update-associated-model/156232 "2008-12-23T05:15:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [December 23, 2008, 5:15am UTC](https://www.ruby-forum.com/t/updating-model-with-has-one-association-do-not-want-to-update-associated-model/156232/1 "2008-12-23T05:15:55Z")

</div>

I have two classes: Article and Update. When I try to update an  
Article, it is NOT saving the instance, but is only saving the  
associated Update object (which is valid).

class Article \< ActiveRecord::Base  
has\_one :update, :as =\> :content, :dependent =\> :destroy  
end

class Update \< ActiveRecord::Base  
belongs\_to :content, :polymorphic =\> true, :readonly =\> true  
end

class ArticlesController \< ApplicationController  
def update  
@article = Article.find(params[:id])

```
if @article.update_attributes(params[:article])
  flash[:notice] = 'Article was successfully updated.'
  redirect_to(@article)
else
  render :action => 'edit'
end

```

end  
end

When I check my log; however, you can see that only the Update object  
was updated, not the Article object. Any thoughts on why? I haven’t  
done much with Rails 2.2, but this is not the behavior I remember from  
earlier versions.

Thanks,  
Josh
