Created
April 3, 2019 21:06
-
-
Save wemrekurt/a6c44a7457b5ce9e635eb876b1771370 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| def create_import(curr, files) | |
| Category.create(curr) | |
| subs = files.select { |i| i['parent_id'] == curr['id'] } | |
| subs.each { |cat| create_import(cat, files) } | |
| end | |
| def create_features(cat, features) | |
| fets = features.select do |i| | |
| i['category_ids'] == cat.id | |
| end | |
| fets.each { |ft| Feature.create(ft) } | |
| cat.children.each { |c| create_features(c, features) } | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment