0

I have this:

def self.testing    
    nodo = Attribute.where(:product_attribute_type_id => 7, :value => 1)  
end

in a Product class method, then I load Attribute Class before a load Product class, then I call the testing method:

a = Product.testing

But I get this error:

undefined method `where' for ActiveRecord::AttributeMethods::Serialization::Attribute:Class

Pointing at testing method, I read some errors and question here, but I don't get error.

Can anyone help me, please?

José Castro
  • 3,976
  • 2
  • 22
  • 26

1 Answers1

1

What is Attribute supposed to be ? You just want to call where (or self.where), not Attribute.where.

Where did you see this method of definining scopes?

NOTE : Oh, I think I get it. You have a model named Attribute -- That won't fly by ActiveRecord. You could always use it by saying ::Attribute, but it's going to break at some point.

Ven
  • 19,015
  • 2
  • 41
  • 61