Skip to content

Bulk adding of children #274

Open
Open
@patrickdavey

Description

@patrickdavey

Hi there,

Thanks for the awesome gem - it's exactly what I was looking for.

I'm having an issue where I'm trying to add 200 child nodes and it's just a slow process. I have had a look through the documentation, but I can't see an easy way to do bulk inserts, at least, not a supported way.

I can do a bulk insert of all the basic Nodes, setting the parent_id properly, but, creating the hierarchy entry correctly is a little trickier (though I am willing to look into that, but the locking made me a little wary).

My situation is perhaps complicated by the fact that I have a position column, and, further that I am currently on Rails 3.2 so I'm using closure tree 5.2 Ideally I'd like to simply set the position when I am doing a bulk insert so that no UPDATE needs to be performed, again, quite unnecessary in my case.

Can you let me know if there's a strategy for bulk insertion? If not, is there an approach which could work which I might be able to offer as a PR?

Thanks for any & all help & pointers - and thanks again for such a great gem!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions