# Hide attribute from scaffolding

**URL:** <https://www.ruby-forum.com/t/hide-attribute-from-scaffolding/167458>\
**Category:** Rails\
**Created:** [May 7, 2009, 10:47pm UTC](https://www.ruby-forum.com/t/hide-attribute-from-scaffolding/167458 "2009-05-07T22:47:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![p-b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a3d4f5/32.png) [@p-b](https://www.ruby-forum.com/u/p-b)\
**Post date:** [May 7, 2009, 10:47pm UTC](https://www.ruby-forum.com/t/hide-attribute-from-scaffolding/167458/1 "2009-05-07T22:47:52Z")

</div>

Hey,

I have a simple model having some attributes. One of those attributes is  
an overall grade, which I don’t want users to be able to edit it on  
their own. I display all the info in the database using a scaffold.

However, while scaffolding, I can see and edit the grade attribute,  
which I only want to be displayed.

---

<div class="post-metadata">

**Author:** ![p-b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a3d4f5/32.png) [@p-b](https://www.ruby-forum.com/u/p-b)\
**Post date:** [May 7, 2009, 11:02pm UTC](https://www.ruby-forum.com/t/hide-attribute-from-scaffolding/167458/2 "2009-05-07T23:02:39Z")

</div>

On 7 May 2009, at 13:47, Bogdan P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hey,
> 
> I have a simple model having some attributes. One of those  
> attributes is  
> an overall grade, which I don’t want users to be able to edit it on  
> their own. I display all the info in the database using a scaffold.
> 
> However, while scaffolding, I can see and edit the grade attribute,  
> which I only want to be displayed.

Just edit the erb files the scaffold generator (and don’t forget to  
enforce that people should be allowed to edit grades, you may want to  
look at attr\_accessible/attr\_protected )

Fred

---

<div class="post-metadata">

**Author:** ![p-b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a3d4f5/32.png) [@p-b](https://www.ruby-forum.com/u/p-b)\
**Post date:** [May 7, 2009, 11:46pm UTC](https://www.ruby-forum.com/t/hide-attribute-from-scaffolding/167458/3 "2009-05-07T23:46:29Z")

</div>

Frederick C. wrote:

> On 7 May 2009, at 13:47, Bogdan P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > Hey,
> > 
> > I have a simple model having some attributes. One of those  
> > attributes is  
> > an overall grade, which I don’t want users to be able to edit it on  
> > their own. I display all the info in the database using a scaffold.
> > 
> > However, while scaffolding, I can see and edit the grade attribute,  
> > which I only want to be displayed.
> 
> Just edit the erb files the scaffold generator (and don’t forget to  
> enforce that people should be allowed to edit grades, you may want to  
> look at attr\_accessible/attr\_protected )
> 
> Fred

Hey Fred… People are allowed to edit grades. The overall grade is  
applied to a photo, and people can rate it, but each one of the ratings  
is kept somewhere else. The grade attribute here holds only the  
arithmetic media of all rates people placed.

I thought there’s some smarter way to hide it from the scaffolding  
except working inside the view…
