id

id() Instance Public methods Returns the primary key value.

quoted_primary_key

quoted_primary_key() Instance Public methods Returns a quoted version of the primary key name, used to construct SQL statements.

primary_key=

primary_key=(value) Instance Public methods Sets the name of the primary key column. class Project < ActiveRecord::Base self.primary_key = 'sysid' end You can also define the primary_key method yourself: class Project < ActiveRecord::Base def self.primary_key 'foo_' + super end end Project.primary_key # => "foo_id"

primary_key

primary_key() Instance Public methods Defines the primary key field â can be overridden in subclasses. Overwriting will negate any effect of the primary_key_prefix_type setting, though.

define_method_attribute

define_method_attribute(attr_name) Instance Public methods

dangerous_attribute_method?

dangerous_attribute_method?(method_name) Instance Public methods

instance_method_already_implemented?

instance_method_already_implemented?(method_name) Instance Public methods Raises a ActiveRecord::DangerousAttributeError exception when an Active Record method is defined in the model, otherwise false. class Person < ActiveRecord::Base def save 'already defined by Active Record' end end Person.instance_method_already_implemented?(:save) # => ActiveRecord::DangerousAttributeError: save is defined by ActiveRecord Person.instance_method_already_implemented?(:name) # =&

dangerous_class_method?

dangerous_class_method?(method_name) Instance Public methods A class method is 'dangerous' if it is already (re)defined by Active Record, but not by any ancestors. (So 'puts' is not dangerous but 'new' is.)

class_method_defined_within?

class_method_defined_within?(name, klass, superklass = klass.superclass) Instance Public methods

attribute_names

attribute_names() Instance Public methods Returns an array of column names as strings if it's not an abstract class and table exists. Otherwise it returns an empty array. class Person < ActiveRecord::Base end Person.attribute_names # => ["id", "created_at", "updated_at", "name", "age"]