Is there a quick and easy way to hide certain
attributes? For example, with ‘members’, I don’t want
the password field to show up in ‘list’. Something
like ‘attr_protected :password’.
thanks
csn
Yahoo! Mail - PC Magazine Editors’ Choice 2005
Is there a quick and easy way to hide certain
attributes? For example, with ‘members’, I don’t want
the password field to show up in ‘list’. Something
like ‘attr_protected :password’.
thanks
csn
Yahoo! Mail - PC Magazine Editors’ Choice 2005
If you’re basing your views on the standard scaffold, you can limit
the columns displayed by generating the list of content_columns in the
controller action:
@content_columns = User.content_columns
@content_columns.delete_if { |c| ["salted_password", "salt",
“security_token”, “token_expiry”].include?(c.name) }
… and then in your list.rhtml view:
<% for column in @content_columns %>
etc.
james.adam wrote:
If you’re basing your views on the standard scaffold, you can limit
the columns displayed by generating the list of content_columns in the
controller action:@content_columns = User.content_columns @content_columns.delete_if { |c| ["salted_password", "salt",
“security_token”, “token_expiry”].include?(c.name) }
Thanks, this works great on the level of a single controller. But how
can I implement hiding on a more global level, e.g. if I never wanted to
show the lock_version or created_at fields in list tables generated by
scaffolds?
My guess is to put this code in controllers/application.rb but what do I
use for the object?
@content_columns = WHATHERE?.content_columns
@content_columns.delete_if { |c| [“salted_password”, “salt”,
“security_token”, “token_expiry”].include?(c.name) }
Thanks for your help
R
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs