Forum: Ruby on Rails hide attribute from scaffolding

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
pb p. (Guest)
on 2009-05-08 00:47
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.
Frederick C. (Guest)
on 2009-05-08 01:02
(Received via mailing list)
On 7 May 2009, at 13:47, Bogdan P. <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
pb p. (Guest)
on 2009-05-08 01:46
Frederick C. wrote:
> On 7 May 2009, at 13:47, Bogdan P. <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...
This topic is locked and can not be replied to.