# Insert only field

**URL:** <https://www.ruby-forum.com/t/insert-only-field/106152>\
**Category:** Rails\
**Created:** [June 6, 2007, 10:03pm UTC](https://www.ruby-forum.com/t/insert-only-field/106152 "2007-06-06T22:03:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3bc359/32.png) [@jon](https://www.ruby-forum.com/u/jon)\
**Post date:** [June 6, 2007, 10:03pm UTC](https://www.ruby-forum.com/t/insert-only-field/106152/1 "2007-06-06T22:03:39Z")

</div>

Hello,

I am new to RoR. I have situation that cannot find solution. I use the  
same user model for signup to system and edit user profile. How to  
make username field just insertable and not updatable? Is it possible  
to restrict this in model?

---

<div class="post-metadata">

**Author:** ![jon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3bc359/32.png) [@jon](https://www.ruby-forum.com/u/jon)\
**Post date:** [June 6, 2007, 10:11pm UTC](https://www.ruby-forum.com/t/insert-only-field/106152/2 "2007-06-06T22:11:40Z")

</div>

On Jun 6, 2007, at 2:02 PM, Jon wrote:

> Hello,
> 
> I am new to RoR. I have situation that cannot find solution. I use the  
> same user model for signup to system and edit user profile. How to  
> make username field just insertable and not updatable? Is it possible  
> to restrict this in model?

Yes, with validations. You can have different validations rules for  
create and update.

[http://api.rubyonrails.com/classes/ActiveRecord/Validations.html](http://api.rubyonrails.com/classes/ActiveRecord/Validations.html)
