Created
February 3, 2012 03:55
-
-
Save willrjmarshall/1727570 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParentClass < ActiveRecord::Base | |
has_many :child_classes | |
end | |
class ChildClass < ActiveRecord::Base | |
belongs_to :parent_class | |
def self.class_method(csv_row) | |
# Pivots the CSV row into a set of ChildClass instances with a reference to parent_class_instance | |
# Like | |
end | |
end | |
# I want to do this: | |
parent_class_instance.child_classes.class_method | |
#like running | |
parent_class_instance.child_classes.create(hash) | |
# but creating a set of instances, not a single instance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment