Displaying 20 results from an estimated 7000 matches similar to: "RESTful acts_as_tree"
2006 May 30
2
acts_as_tree, acts_as_list and is invincible (help!)
So I have the following model
class Topic < ActiveRecord::Base
belongs_to :topic
has_many :topics, :order => :position
acts_as_tree :order => :position
acts_as_list :scope => :topic_id
end
that I use for a site''s navigation. Everything (list, create, edit, even
the drag&drop sort) works fine, except the destroy function, which the
vanilla version
def destroy
2009 Feb 19
3
Associated child records not created on creation of a parent.
I am trying to create a record with association. Within the create
method, I would also like to pre-populate dependent (has_many) records
from a template in the database.
The child records are <u>mysteriously rolled back </u> if I insert
them in a loop. If I try to insert a single child record, it works.I
have read the books and tried to google my way out of this but am at a
dead
2006 Feb 08
1
Many-To-Many w/acts_as_tree?
Guys,
I''m having a problem getting acts_as_tree working. It seems from the
Agile book (p. 255) that acts_as_tree only supports one-to-one record
relations, whereas I need many-to-many support. In other words, looking
at the picture at the top of page 256 where where only 1 id is linked to
1 parent_id, I need multiple id''s linked to multiple parent_id''s - for
2006 Jun 19
3
Using set_primary_key breaks acts_as_tree with non-integer column
I just switched from using the standard "id" column into using my own
primary key and generating my own unique id for each record. But, this
breaks acts_as_tree.
Because my new primary key is not an integer, it breaks the SQL query
as follows:
StatementInvalid in PagesController#create
--------------------------------------------------------------------------------------
2006 Jul 17
1
acts_as_tree and :include
hello there,
i have a model that uses acts_as_tree:
>class GbEntry < ActiveRecord::Base
> acts_as_tree :order => ''created_at DESC''
>end
and i want it to paginate, including all children to avoid unnecessary
db queries:
> @gb_entry_pages, @gb_entries =
> paginate :gb_entries, :per_page => 15, :order => ''created_at DESC'',
2005 Sep 23
6
problem with acts_as_tree
Hi,
I''m using the latest gem version of rails under MacOS Tiger.
I was trying to use acts_as_tree as described in the rails book. So
I have something like:
class Category < ActiveRecord::Base
acts_as_tree :order => "title"
end
create table categories (
id int not null
auto_increment,
title
2006 Jun 20
2
Converting from acts_as_tree to acts_as_nested_set
I''m currently using acts_as_tree to display threaded Comments on my
forums-like site. It''s waaay too slow to display a page with 1,000
comments, as it''s issuing a TON of selects.
I''m pretty sure I want to convert to the nested set model, using
acts_as_nested_set or acts_as_threaded. This should give me the
performance I''m looking for.
The problem,
2005 Jul 25
2
acts_as_tree and traversing parent/child relationships
I am working on an Rails application that uses a pretty complex
category structure through out the site. I have defined a table to
house all the info and a FK to reference parents within the table
CREATE TABLE categories (
id int(11) NOT NULL auto_increment,
name varchar(50) NOT NULL,
parent_id int(11) default NULL,
constraint fk_category_id foreign key (category_id) references
2006 Jan 15
2
acts_as_tree & acts_as_list for a single model?
Hi,
If I have a db table
categories
- id
- name
- parent_id
- position
is it alright to have the Category model act_as_tree and for each
level act_as_list?
class Category < ActiveRecord::Base
acts_as_tree :order => :position
acts_as_list :scope => :parent_id
end
Thanks,
Peter
2006 Jul 20
3
acts_as_tree
Hello,
I''m trying to create categories that have their own subcategories, and each
subcategory may have its own subcategories, .. and so on.
After some reading, I found out that the best way for creating such a thing
is to use acts_as_tree, but I didn''t find any tutorial or article that
explain this in a clear way. After a lot of work I was finally able to
create categories and
2006 Jun 08
2
counter_cache is not looking for children_count with acts_as_tree
Hi there, the acts_as_tree API says that I can set a counter cache and
that it will automatically increment the "children_count" column. I
did that but when I create a new page it asks for a "pages_count"
column instead.
Here is the relevant part of page.rb model:
class Page < ActiveRecord::Base
acts_as_tree :order => :position, :counter_cache => true
2007 Jan 25
1
acts_as_tree with acts_as_list
Hello all,
I''m having trouble using acts_as_list with acts_as_tree
to order the "children". I''ve found a few old posts on the web
that seem to indicate that this once worked.
class Whatever < ActiveRecord::Base
acts_as_tree :order => :position
acts_as_list :scope => :parent_id
Although the ''position'' field is being populated,
it appears
2005 Dec 15
4
Acts_as_tree and routing
I''ve got an acts_as_tree structure which I want to be able to represent
in the URL, with one field identified as the url component. In other
words, if I''ve got this:
def self.up
create_table :nodes do |t|
t.column :parent_id, :integer
t.column :tag, :string
end
end
and
class Node < ActiveRecord::Base
acts_as_tree
end
and what I want the urls to be is something
2006 Sep 13
1
Eager loading with acts_as_tree
So I have a model that acts_as_tree and I run a method on a collection
of all of these records. This method walks the tree and fetches the
parent/children, etc. This results in many, many duplicate SQL queries
to be executed. Is there a way to eagerly load all of these models?
Something along the lines of:
Model.find(:all, :include => [:children, :parent])
If I execute the above statement, I
2006 Mar 08
0
acts_as_tree circular reference
my application is using acts_as_tree to create a directed graph.
Everyone would work fine, except that nothing prevents the user to
create a circular reference:
>> item.parent=child
>> item.save
=> true
>> child.parent=item
>> child.save
=> true
I checked in the database, and there it is: an item that has as parent
its own child!
item.parent_id = child_id
I
2006 Jun 13
3
acts_as_tree problem accessing parent object
i have a model called certification_types that i''ve declared as
acts_as_tree. I have a model called certification that belongs_to
:certification_type .
class CertificationController < ApplicationController
.....
def summary_list
@certifications = Certification.find(:all, :order=>''date'')
end
end
summary_list.rhtml
<% for certification in
2005 Mar 01
0
acts_as_tree counter_cache
Hi List,
I''m new to and hot on RoR.
And I have a question regarding acts_as_tree and counter_cache.
What methods actually update the counter_cache column?
I''ve only really started the app so i''ve just got it set up so that I
can select the parent node (from a list of nodes that exclude all
descendants of the current node) with a radio buttoned list named and
valued
2007 Aug 30
0
Problem with data migration and acts_as_tree
Hi, this is my first post here, my name is Lucas and I''m just starting
with rails.
For one of the first models I made (an accounts plan), I had some
example data in a CSV file, so I created this migration, the idea is
to detect the parent/child relationships according to the account
number, the code works right (if I insert some puts here and there, I
can see it), but when the migration
2006 Jun 16
1
sortable acts_as_tree with heirarchy
I''ve been stumbling on the tut at oriontransfer
(http://wiki.oriontransfer.co.nz/main/show/SortableTree)
I''ve got it working in a one dimensional list and I''ve got the drag and
drop working on children, but as can''t get it to save the tree.
Here''s my view:
<h2>Menu Prototype 2</h2>
<%= flash[:notice] %>
<ul
2007 May 02
3
acts_as_tree related question
hi,
I''ve a normal Category model implemented with acts_as_tree (name,
parent_id) that has_many :products (name, category_id).
What I''m asking for is a method to fetch every product that belongs
fall into a particular category and its children, eg: if I''m asking
for a root node (/category/show/1) I need to display every product
that have category_id = 1 AND every product