This project is archived and is in readonly mode.

#494 ✓invalid
jmcafee

Missing attribute-related methods in ActiveRecord::Base

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

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.

Comments and changes to this ticket

  • jmcafee

    jmcafee June 26th, 2008 @ 08:50 PM

    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.

  • Jeremy Kemper

    Jeremy Kemper June 26th, 2008 @ 09:28 PM

    • State changed from “new” to “invalid”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages