# Make sure that model.attribute is only set on :create?

**URL:** <https://www.ruby-forum.com/t/make-sure-that-model-attribute-is-only-set-on-create/117639>\
**Category:** Rails\
**Created:** [October 18, 2007, 9:13pm UTC](https://www.ruby-forum.com/t/make-sure-that-model-attribute-is-only-set-on-create/117639 "2007-10-18T21:13:39Z")\
**Posts on this page:** 4\
**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:** [October 18, 2007, 9:13pm UTC](https://www.ruby-forum.com/t/make-sure-that-model-attribute-is-only-set-on-create/117639/1 "2007-10-18T21:13:39Z")

</div>

Hi all

My model Link has an attribute creator\_id which contains a foreign key  
to my Member model table.  
I want to make sure that the creator\_id is only “changeable” during the  
creation, and after it can’t be changed anymore.

How can this be accomplished in the easiest way?

Thanks for help  
Josh

---

<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:** [October 18, 2007, 9:16pm UTC](https://www.ruby-forum.com/t/make-sure-that-model-attribute-is-only-set-on-create/117639/2 "2007-10-18T21:16:44Z")

</div>

> My model Link has an attribute creator\_id which contains a foreign key  
> to my Member model table.  
> I want to make sure that the creator\_id is only “changeable” during the  
> creation, and after it can’t be changed anymore.
> 
> How can this be accomplished in the easiest way?

[http://agilewebdevelopment.com/plugins/search?search=locked](http://agilewebdevelopment.com/plugins/search?search=locked)

---

<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:** [October 19, 2007, 11:08am UTC](https://www.ruby-forum.com/t/make-sure-that-model-attribute-is-only-set-on-create/117639/3 "2007-10-19T11:08:47Z")

</div>

Thank you 🙂

Philip H. wrote:

> > My model Link has an attribute creator\_id which contains a foreign key  
> > to my Member model table.  
> > I want to make sure that the creator\_id is only “changeable” during the  
> > creation, and after it can’t be changed anymore.
> > 
> > How can this be accomplished in the easiest way?
> 
> [http://agilewebdevelopment.com/plugins/search?search=locked](http://agilewebdevelopment.com/plugins/search?search=locked)

---

<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:** [October 19, 2007, 1:27pm UTC](https://www.ruby-forum.com/t/make-sure-that-model-attribute-is-only-set-on-create/117639/4 "2007-10-19T13:27:23Z")

</div>

On Oct 19, 2:08 am, Joshua M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > [http://agilewebdevelopment.com/plugins/search?search=locked](http://agilewebdevelopment.com/plugins/search?search=locked)
> 
> –  
> Posted viahttp://www.ruby-forum.com/.

nobody’s asked inh 3 days:

[http://groups.google.com/group/rubyonrails-talk/browse\_frm/thread/411510544859a6b8/5427048061782e36#5427048061782e36](http://groups.google.com/group/rubyonrails-talk/browse_frm/thread/411510544859a6b8/5427048061782e36#5427048061782e36)
