Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Missing attribute-related methods in ActiveRecord::Base

#494

Working in either 2.0.2 or 2.1, I found that models are missing attribute methods, such as attribute(), has_attribute?, column_for_attribute methods, etc.

Trying to access any one of these methods, for example, using Modelname.attributes(), gives the following error:

NoMethodError: undefined method 'attributes' for # from [...] active_record/base.rb

Checking with Modelname.methods.sort, these methods are not in the returned list.

However, these methods appear to be in base.rb - why are they not available to any of the models?

I confirmed this on several different applications running 2.0.2 and 2.1, in both Linux and Windows.

Reported by jmcafee · June 26th, 2008 @ 08:16 PM

State: invalid
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. jmcafee
    jmcafee

    After further investigation, it appears that I can use the methods against an object based on the model, so I guess I didn't understand the usage properly. I think the documentation is a little fuzzy about which methods belong to the model and which belong to a model object.

    June 26th, 2008 @ 08:50 PM

  2. Jeremy Kemper
    Jeremy Kemper
    • State changed from new to invalid

    June 26th, 2008 @ 09:28 PM