acts-as-tree

Formtastic select with grouping

こ雲淡風輕ζ 提交于 2019-12-13 12:04:28
问题 Now with Formtastic I have plain select: = f.input :category, :as => :select, :include_blank => false, :collection => subcategories Here I show only children categories. I use acts_as_tree plugin for parent-child relationship. I would like to show parent categories as well. Formtastic generated select should look like this one: <select name="favoritefood"> <optgroup label="Dairy products"> <option>Cheese</option> <option>Egg</option> </optgroup> <optgroup label="Vegetables"> <option>Cabbage<

Acts as Tree with Multiple Models

白昼怎懂夜的黑 提交于 2019-12-11 02:15:53
问题 I've got several models that I'd like to relate together hierarchically. For simplicity's sake, let's say I've got these three: class Group < ActiveRecord::Base acts_as_tree has_many :users end class User < ActiveRecord::Base acts_as_tree belongs_to :group has_many :posts end class Post < ActiveRecord::Base acts_as_tree belongs_to :user end Under the current acts_as_tree, each node can individually can relate hierarchically to other nodes provided they are of the same type. What I'd like is

acts_as_tree vs ancestry gem for tree menu [closed]

≯℡__Kan透↙ 提交于 2019-12-07 18:21:28
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . I want to implement a tree menu (simple example of tree menu) in a Rails app that I am working on. I am unsure of whether to use acts_as_tree or Ancestry. Its seems that it would be easier to implements a simple tree menu using acts_as_tree, however, Ancestry is more popular

acts_as_tree vs ancestry gem for tree menu [closed]

对着背影说爱祢 提交于 2019-12-05 22:13:18
I want to implement a tree menu ( simple example of tree menu ) in a Rails app that I am working on. I am unsure of whether to use acts_as_tree or Ancestry. Its seems that it would be easier to implements a simple tree menu using acts_as_tree, however, Ancestry is more popular and regularly maintained. Does anyone have any thoughts on this? Use ancestry. It has more powerful query capabilities as it implements the materialized path pattern , as opposed to acts_as_tree that implements adjacency list . There are other options too, like nested set, but materialized path is usually the most

Generate a file list based on an array

末鹿安然 提交于 2019-12-05 05:41:34
问题 I tried a few things but this week i feel like my brain's having holidays and i need to complete this thing.. so i hope someone can help me. I need to create a filelist based on a hash which is saved into a database. The has looks like this: ['file1', 'dir1/file2', 'dir1/subdir1/file3'] Output should be like this: file1 dir1 file2 subdir1 file3 in html, preferrably like this (to extend it with js to fold and multiselect) <ul> <li>file1 <li>dir1</li> <ul> <li>file2</li> <li>subdir1</li> <ul>

Acts-as-tree in Rails3?

纵然是瞬间 提交于 2019-12-04 13:02:08
问题 I need to use Acts As Tree in my Rails3 project (ruby 1.9.2). But, there are lot of forks on github, so I don't know which should I choose, and which is used by other developers? On Railsplugins.org there are http://www.railsplugins.org/plugins/376-acts-as-tree, but last commit was from March... 回答1: I'm using http://rubygems.org/gems/acts_as_tree_rails3. Works great. 回答2: I've gone with https://github.com/skyeagle/nested_set on my Rails3 projects. It's hard to say at this point where

Reddit-style nested/threaded/indented comments for Rails?

情到浓时终转凉″ 提交于 2019-11-28 13:53:44
问题 I'm wondering if someone has already built a system for threaded comments (for lack of a better term) in Rails or if I need to build it myself. In case it's not clear, what I'm referring to is a comment system like Reddit's that automatically indents replies so that they appear like branches of a tree (preferably with voting just as Reddit does). If someone could point me to code that does this, it would be greatly appreciated. Or perhaps there is an open source project that includes this