Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't like abstract classes. #1

Open
fosrias opened this issue Apr 26, 2010 · 1 comment
Open

Doesn't like abstract classes. #1

fosrias opened this issue Apr 26, 2010 · 1 comment

Comments

@fosrias
Copy link

fosrias commented Apr 26, 2010

Blows up when it tries to find the columns of an abstract class. Fix is easy by adding line:

def transform_legacy_attribute_methods(*args, &block)

  return if self.abstract_class? 

...

Also, for this to work, the abstract class getter must be defined in a model before transform_legacy_attribute_methods. E.g.

class Human < ActiveRecord::Base

def self.abstract_class?
true
end

transform_legacy_attribute_methods

end

@sshaw
Copy link
Owner

sshaw commented Apr 27, 2010

Hi, I believe my thinking behind this was that since abstract classes do not have a table there are no legacy columns to transform.

The transformation(s) are done when the class is loaded, so returning when the class is abstract would prevent a subclass' columns from being transformed.

In the case that abstract_class? was true, transformation could be placed in the the abstract class' inherited() method, though this is flimsy since it depends the order self.abstract_class and transform_legacy_attribute_methods are called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants