Forum: Ruby on Rails Where's the list of valid attributes / methods for column ob

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.
2b891e820c238ded365d035771603f21?d=identicon&s=25 Bill Walton (Guest)
on 2007-03-02 06:14
(Received via mailing list)
I'm trying to figure out what the valid attributes are on a column
object.
The Rails scaffolding generates a list view that uses column.column_name
for
example. ActiveRecord::Base#columns says it returns "an array of column
objects for the table associated with this class".  But I can't find a
list
of the attributes of / methods on a column object anywhere.

Any help would be very much appreciated.

Thanks,
Bill
72ee7b478a235f646c3495f03ebbe676?d=identicon&s=25 Andrew Stewart (Guest)
on 2007-03-02 10:17
(Received via mailing list)
Hello,

On 2 Mar 2007, at 05:07, Bill Walton wrote:
> I'm trying to figure out what the valid attributes are on a column
> object.
> The Rails scaffolding generates a list view that uses
> column.column_name for
> example. ActiveRecord::Base#columns says it returns "an array of
> column
> objects for the table associated with this class".  But I can't
> find a list
> of the attributes of / methods on a column object anywhere.

Try using script/console:

Let's say that you have a User model.

 >> User.columns.first.methods
=> ["to_a", "respond_to?", "returning", "daemonize", "type", "limit",
"protected_methods", "human_name", "silence_stream", "eql?",
"number?", "instance_variable_set", "precision", "is_a?", "taguri",
"hash", "to_s", "send", "dclone", "remove_subclasses_of", "ri",
"pretty_print_cycle", "primary", "default", "with_options",
"taguri=", "silence_warnings", "pretty_print_inspect", "class",
"tainted?", "private_methods", "primary=", "__send__", "to_yaml",
"to_yaml_properties", "untaint", "scale",
"extend_with_included_modules_from", "id", "instance_eval",
"inspect", "require_library_or_gem", "pretty_print", "klass",
"type_cast_code", "clone", "text?", "public_methods", "b64encode",
"extended_by", "extend", "require_gem", "freeze", "suppress",
"display", "encode64", "instance_values", "po", "type_cast", "`",
"__id__", "pretty_print_instance_variables", "methods", "==",
"method", "sql_type", "decode64", "gem", "===", "to_json",
"subclasses_of", "dup", "nil?", "enable_warnings",
"instance_variables", "copy_instance_variables_from", "instance_of?",
"load", "name", "poc", "to_param", "instance_exec", "=~",
"object_id", "singleton_methods", "decode_b", "null", "unloadable",
"taint", "equal?", "silence_stderr", "blank?",
"instance_variable_get", "frozen?", "kind_of?", "require",
"to_yaml_style"]

Regards,
Andy Stewart
C237cf537a06b60921c97804679e3b15?d=identicon&s=25 John Barnette (Guest)
on 2007-03-02 22:26
(Received via mailing list)
This topic is locked and can not be replied to.