Questions tagged [acts-as-nested-set]

11 questions
3
votes
4 answers

Rails - Comments w acts_as_nested_set - When Deleting a Dependent Record is Deleting Destroy Data

I have the following Models: class Group < ActiveRecord::Base has_many :threads, :dependent => :destroy class Thread < ActiveRecord::Base has_many :comments, :as => :commentable, :dependent => :destroy class Comment < ActiveRecord::Base …
AnApprentice
  • 108,152
  • 195
  • 629
  • 1,012
2
votes
1 answer

How to reorder nodes within a node using awesome_nested_set

If I have a tree like this: Page1 ---Page1.1 ---Page1.2 ---Page1.3 Using awesome_nested_set, how would I move Page1.x up or down within the Page1 node? Thanks.
Jim Jones
  • 2,767
  • 4
  • 33
  • 39
1
vote
1 answer

Rails acts as nested set return descendant of all records in a has_many relation

I am using the awesome_nested_set gem and am trying to get all the descendants of a has_many relationship. A User has many tasks shared to them and each task has many children. Ho do I get a list of a Users tasks_shared_to and all their children…
mahi-man
  • 4,326
  • 2
  • 25
  • 36
1
vote
1 answer

ActionView::Template::Error (no implicit conversion from nil to integer) - awesome_nested_set

I'm using awesome_nested_set to implement nested pattern in select tag. When there is no record in the database form is loading successfully, but after adding first category as base category whose parent_id is null this error is showing…
Rajdeep Singh
  • 17,621
  • 6
  • 53
  • 78
1
vote
0 answers

How to order a Doctrine Nested Set Tree when querying

I have a table that acts as a nested set. The problem is, that the table have fields 'short_name' and 'long_name' and in different places i have to order the results accordingly. I'm using Doctrine's "HYDRATE_RECORD_HIERARCHY" hydration mode when…
sanya
  • 860
  • 1
  • 8
  • 20
1
vote
0 answers

Mongoid nested set helper same as in awesome_nested_set

Gem Awesome_nested_set has useful helper(nested_set_options) which provides buiding tree for select elements. <%= f.select :parent_id, nested_set_options(Category, @category) {|i| "#{'-' * i.level} #{i.name}" } %> Gem Mongoid_nested_set is a mongo…
Ivan Schneider
  • 1,145
  • 1
  • 11
  • 20
1
vote
0 answers

Rails nested set with overridden attributes and associations?

Is there a nested_set gem that will let you inherit a parent's attributes and associations and let you override specific attributes, storing the overrides independent of the parent?
tesserakt
  • 3,231
  • 4
  • 27
  • 40
0
votes
1 answer

Get first in level in acts_as_nested_set

I'm using awesome_nested_set in my rails app...in my view I'm displaying my nested categories using each_with_level. How do I determine if the category I'm displaying in the loop is the first in the level. My list displays like this:
0
votes
1 answer

rails acts_as_nested_set with uniqueness

I'm using acts_as_nested_set on a model which is called node. There are multiple lists stored in the database, each starting with the root node. The root node doesn't have a parent, that's how I know it's a root. Now this all works as expected, but…
Tim Baas
  • 6,035
  • 5
  • 45
  • 72
0
votes
1 answer

Eager loading ancestors tree for multiple leaves

I am looking for an efficient way to retrieve the category tree to display along with the results for product search. A product can have one or more categories (many-to-many relationship to leaf categories). The idea is to reconstruct the ancestor…
ksiomelo
  • 1,878
  • 1
  • 33
  • 38
-1
votes
2 answers

help a n00b understand rails, specifically inheritance, acts_as_nested_set, awesome_nested_set, sortable_element_for_nested_set

hey there, i'm trying to implement a drag and drop interface for a nested set in my first rails project. i'm new to rails so bear with me. my code is basically identical to this project: http://gist.github.com/128779. my problem is in the…
johnny