Ancestry is a gem/plugin that allows the records of a Ruby on Rails ActiveRecord model to be organised as a tree structure
Questions tagged [ancestry]
194 questions
0
votes
2 answers
Ancestry gem "flattened tree"
I've been hitting my head up against this one all day. Time for new eyes.
I have a tree-structured model using the ancestry gem. Works great and calling TreeNode.arrange returns a tidy little hash that is a nested tree. The problem is I'm looking…

Kansha
- 570
- 4
- 12
0
votes
0 answers
Rails Ancestry undefined method `model_name' for NilClass:Class
I'm trying to learn how to use the "Ancestry" gem. I watched the related episode in Railscast and get the code. The message table works fine. But I'm trying to duplicate it with a new table called locations. I've copied and changed names on all the…

Reddirt
- 5,913
- 9
- 48
- 126
0
votes
1 answer
offset and limit taking into consideration the top level with ancestry gem
I am writing a simple message board system. One thing about ancestry is that it uses a single call so that if I call with limit and offset, it will not return a consistent list of top level elements. I need the @per_page and the_offset for handling…

timpone
- 19,235
- 36
- 121
- 211
0
votes
0 answers
dynamic dropdown menu ancestry and rails 3
Hi I have try to do dynamic drop down menu using ancestry and rails 3.2 but don't have to much experience with javascript.
I have got categories with ancestry tree and Ads (model/controller). Ads should have one category. So my idea is when I…

nikos83
- 355
- 1
- 5
- 19
0
votes
1 answer
Ancestry: skip element from scope
Using gem ancestry.
How skip self element from Category::ActiveRecordRelation or need use scope?
= simple_form_for @category do |f|
= f.input :parent_id, collection: Category.roots
Something like:
= f.input :parent_id, collection:…

Mikhail Grishko
- 4,258
- 3
- 22
- 21
0
votes
1 answer
Need help walking through nested hashes
Pardon my ignorance, I'm new to Ruby, but not programming. I'm using a gem called Ancestry to store hierarchical data in my application. They have a method called "descendants" that returns a nested hash of all the descending children,…

Ken
- 626
- 1
- 8
- 22
0
votes
1 answer
jquery: can't get appendTo on parents() to work, may not understand parents() method?
The following code block does not work:
$("").prependTo(chapter.parents(".chapter")).each( function(index) {
$(this).html((parseInt($(this).text() || 0)+1)+"");
});
where 'chapter' is a node that in this case is nested…

Rob F
- 529
- 6
- 17
0
votes
1 answer
How to get the descendants of all objects in an array? (Rails + ancestry gem)
I am using this gem https://github.com/stefankroes/ancestry for my People modle. The table looks like this:
+----+----------+
| id | ancestry |
+----+----------+
| 1 | NULL |
| 2 | 1 |
| 3 | 1 |
| 4 | 1/2 |
| 5 | 1/3 …

Luke Huang
- 13
- 4
0
votes
1 answer
How to create Category tree using ancestry Ruby on Rails 3
I'm trying to make category tree using ancestry Ruby on Rails 3.
My _form.html.erb
<%= form_for(@category) do |f| %>
<% if @category.errors.any? %>
<%= pluralize(@category.errors.count, "error") %>…

nikos83
- 355
- 1
- 5
- 19
0
votes
1 answer
How to let registred users register other users with Devise?
I am creating a informationsystem for a friend of mine, where (already) registered users can register other users for use within the system. The already registered user must also act as the 'parent' of the newly registered user (which is the…

Nazeem
- 746
- 1
- 10
- 29
0
votes
1 answer
Why do I keep getting this error when I try and run rake db:migrate?
== AddAncestryToMessages: migrating ==========================================
-- add_column(:messages, :ancestry, :string)
rake aborted!
An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: no such table:…

BigBoy1337
- 4,735
- 16
- 70
- 138
-1
votes
1 answer
rails ancestry group table view
for example i have active record like this. below
[{id: 1, ancestry: nil, name: "Person 1"},
{id: 2, ancestry: nil, name: "Person 2"},
{id: 3, ancestry: nil, name: "Person 3"},
{id: 4, ancestry: 1, name: "Child 1"},
{id: 5, ancestry:…

wiwit
- 73
- 1
- 7
- 26
-1
votes
2 answers
Association between Post and Location
This my first ruby on rails application.
Model Location and Post, Location has many post.I create location as tree structure with ancestry gem.
class Post < ActiveRecord::Base
belongs_to :location, :counter_cache => true
end
class Location <…

Mary Smith
- 121
- 2
- 10
-1
votes
1 answer