You've defined abstract_class? as an instance method rather than as a class method. It's a little less verbose to just do class Item < ActiveRecord::Base self.abstract_class = true end
Fred
You've defined abstract_class? as an instance method rather than as a class method. It's a little less verbose to just do class Item < ActiveRecord::Base self.abstract_class = true end
Fred
What's the actual code you've got, the actual error message you get and the database structure of the books table ?
Fred
In your initialize you need to call the super class initialize method (AR::Base's initialize sets up some important stuff). Also I seem to recall that there are some issues involved with overriding AR::Base's implementation of initialize. At the very least you need to make your initialize pass through any arguments or block specified to super
Fred
Sure you do:
def initialize @quantity = 1 end
That should probably be
def initialize(*args, &block) super(*args, &block) @quantity = 1 end
Or, don't define initialize at all and use an after_initialize callback.
Fred