nvm, i checked out ActiveRecord::Base and I found no such thing. But I
did find a nice patch that was made 2 years ago
http://dev.rubyonrails.org/ticket/8913
I changed it around to this to match the the code in rails 2.2.2
# Hide columns from active record
def attr_hidden(*attributes)
write_inheritable_attribute(:attr_hidden,
Set.new(attributes.map(&:to_s)) + (hidden_attributes || []))
end
def hidden_attributes # :nodoc:
read_inheritable_attribute(:attr_hidden)
end
and changed ActiveRecord::Base.column ofcourse
# Returns an array of column objects for the table associated with
this class.
def columns
unless defined?(@columns) && @columns
@columns = connection.columns(table_name, "#{name}
Columns").delete_if {|c| attr_hidden.member?(c.name)}
@columns.each { |column| column.primary = column.name ==
primary_key }
end
@columns
end
wish something like this is implemented. in my mind it is pretty useful.
Ofcourse i do wish it could be a lil bit more automated by looking into
the DB for the column privileges, but this is cool. =D
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---