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
1 answer
Rails: Trouble With Model Association Using Ancestry Gem (Tree Structur Model)
I am working on a simple app that allows a user to write a post (parent_post), and another user to answer this post (child_post).
I am using the Ancestry gem to track the relationships between the posts.
Ancestry is a gem/plugin that allows the…

YvonC
- 329
- 2
- 6
- 22
0
votes
0 answers
Grouping questions under a Template using Rails and Ancestry
I am working on a Rails4.0 application in which I am using gem Ancestry for the hierarchy implementation. I have a Template model which has many questions. I have to be able to group and sub group these questions model. Each template can have many…

bhvd
- 55
- 1
- 7
0
votes
2 answers
Rails and ancestry - form submits 'parent_id' empty
I've followed Railscast episode #262 tutorial on ancestry. But when I submit my form, the rails server log says that parent_id is empty:
rails server log:
Started POST "/posts/1/comments" for 127.0.0.1 at 2013-09-26 16:14:59 +0200
Processing by…

beo
- 1
- 1
0
votes
1 answer
Tree menu using ancestry in rails
according to this answer https://stackoverflow.com/a/11335283/2397494
i'm trying to make tree menu for my appliction
this answer working only for root and first children.
I'm looking for suggestion to transform this code, work well with n…

Ruba Ruba
- 39
- 8
0
votes
1 answer
Ancestry Gem saves all threaded messages as Parent
Currently implementing Threaded Messaging. via RailsCast
I've installed the Ancestry gem, however all messages that I create are parents. ie.) Ancestry = nil
Even after passing my parent:id to new action
Message Controller
def index
@message =…

RedRory
- 632
- 1
- 6
- 18
0
votes
0 answers
Displaying all fields in rails ancestry
I've followed http://railscasts.com/episodes/262-trees-with-ancestry for creating forums
In messages_helper.rb
def nested_messages(messages)
messages.map do |message, sub_messages|
render(message) + content_tag(:div,…

Santh Nish
- 169
- 2
- 15
0
votes
1 answer
Implementing ancestry on a nested resource throwing an error
I am implementing ancestry on a nested resource.
resources :loads do
resources :messages
end
Here is my index action
def index
load = Load.find(params[:load_id])
@messages = load.messages.scoped
@message = load.messages.new
end
My…

user2297820
- 5
- 3
0
votes
1 answer
Using different template on the show page using ancestry gem
Hello Stackoverflow peeps,
I follow ryan bates railscast about using dynamic pages using the Ancestry gem. I wonder if there is a way to use multiple show pages.
For example I have sections and pages. I want to show a template for the sections and a…

wmena
- 3
- 1
0
votes
0 answers
rails ancestry association collection sort order
I have a Locations table that uses the Ancestry gem. I would like to sort the entries when I'm using the "subtree" selection.
This works without subtree:
<%= f.association :location, :label_method => :name_desc, :collection => Location.all(:order…

Reddirt
- 5,913
- 9
- 48
- 126
0
votes
1 answer
Unicorn has undefined method error ONLY in production
My app is working great in development mode AND production using WEBrick.
But in Unicorn, it only works in development mode. As soon as I try to edit or update a category I get a no method error. Any help is appreciated, Thanks!
Error:
Started GET…

BJ McDuck
- 164
- 1
- 12
0
votes
1 answer
Arranging Ancestry siblings by name and integer
I have a model called Category, I can find the siblings of my current category by calling @category.parent.siblings or Category.siblings_of(params[:id]) but as soon as I try to sort either of those requests I get method errors.
If I call…

BJ McDuck
- 164
- 1
- 12
0
votes
2 answers
modify friendly_id gem
I want to be able in browsing bar see full path to some product. The path would look like this
www.mysite.com/categories/category_name/subcategory_name/product_name
At this moment I have just
www.mysite.com/categories/category_name
It just…

Edgars
- 913
- 1
- 19
- 53
0
votes
2 answers
Rails ancestry: Get children records of ancestry model
I've two models:
Post
- category_id
Category (ancestry model)
The category tree looks for example like this:
- Root Category
- Sub Category
Now lets say a post gets categorized to Sub Category. I'm in the Root Category and i would like to see…

Oliver
- 801
- 13
- 26
0
votes
1 answer
Rails nested routes with multiple categories
i'm trying to figure out how i can get nested routes like this:
match '/:category_id/:subcategory_id/:id', via: 'get', controller: 'categories', action: 'index', as: 'category'
the subcategory and the id shouldn't be required. it should be possible…

Oliver
- 801
- 13
- 26
0
votes
1 answer
Active navigation menu rails and Anchestry
I used Ancestry gem to provide full categorization function to my website.
At this point I want to create navigation menu.
The idea, is like this.
I click on main category, it navigates to it, there I can see all subcategories. I click on one of…

Edgars
- 913
- 1
- 19
- 53