-
Notifications
You must be signed in to change notification settings - Fork 342
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
Add support for importing taxonomy via CSV. #289
Conversation
This allows categories to be created in a tree structure supported by the ancestry gem. To see an example of a valid CSV file that recreates the Open Eligibility taxonomy, look at data/taxonomy.csv For more details about how taxonomy works, read our Wiki article on taxonomy basics: https://github.com/codeforamerica/ohana-api/wiki/Taxonomy-basics Special thanks to @volkanunsal for the feature request and getting this work started.
Add support for importing taxonomy via CSV.
Awesome. Just one question. Does |
Calling it |
I'll let you know soon. The problems I ran into so far were mass-assignment not allowed errors on |
You can ignore those errors. It's just letting you know that |
Note that you would also see the same mass-assignment warnings regardless of what the column is called, unless you remove them from the hash before passing them on. |
Here is an error I've been getting:
|
@@ -0,0 +1,11 @@ | |||
class CategoryPresenter < Struct.new(:row) | |||
def to_category | |||
return parent_category(row).children.create(row) if row[:parent_id].present? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where the error originates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Figured out that there was an error in creating the parent category, which was suppressed because it's not created with a bang.
This allows categories to be created in a tree structure supported by the ancestry gem. To see an example of a valid CSV file that recreates the Open Eligibility taxonomy, look at data/taxonomy.csv
For more details about how taxonomy works, read our Wiki article on taxonomy basics:
https://github.com/codeforamerica/ohana-api/wiki/Taxonomy-basics
Special thanks to @volkanunsal for the feature request and getting this work started.