Displaying 20 results from an estimated 10000 matches similar to: "acts_as_tree circular reference"
2006 Apr 07
2
errors.add_to_base
What are the limitations on using:
errors.add_to_base
to display errors in views?
I have tried for days to add errors from my object.rb and they never get
displayed.
class Keyword < ActiveRecord::Base
validates_presence_of(:name, :message => "Name is required.")
validates_uniqueness_of(:name, :message => "This name is already in
use. Please try
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 Apr 20
4
Many to Many Category structure with itself
Basically, I''m trying to have a table called "categories" have a many to
many relationship with itself. But I also want each catagory to be able
to be "copied" into another category so it is essentially a child
category to more than one parent. To me the obvious way of doing this is
by creating another table called category_maps (and a model called
CategoryMap).
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,
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
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
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
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
2008 Nov 13
0
RESTful acts_as_tree
Hello,
I was trying to use the acts_as_tree plugin and I got stuck when
trying to do it in a RESTful way. I have a Place model that can have
and belong to other places. What is the correct method of creating new
places in a RESTful way? I don''t necessarily care about have an url /
place/id/place/id. I''m mostly interested to know the correct way of
passing the parent_id in order
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
2007 Oct 22
1
self-referential habtm: why are my keys null?
I''m trying to set up a directional self-referential HABTM to represent
an arbitrary semi-hierarchical structure; it works for any data
prepopulated into the db, but when I try to create a new relationship,
I just get NULLs in both key columns (or 0''s if I turn on the no-null
constraint).
Here are the migrations:
class CreateNodes < ActiveRecord::Migration
def self.up
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
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