Displaying 20 results from an estimated 5000 matches similar to: "Expecting field value and getting record"
2006 Feb 02
3
acts_as_family_tree
For a project that I am working on I need to have a family tree. This
means that instead of having one parent each item has at most two. As
far as I know acts_as_tree only allows one parent_id. Any suggestions
on how to make a "acts_as_family_tree" ?
Thanks,
Mark
--
--------------------------------------------------------------------
I am Mark Daggett and I approve this message.
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
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 Jan 12
4
How do you create a tree strucutre with ActiveRecord
I want to build an application that has the concept of administrative
domains. What I mean by this is that administrators have access to
different data, based on what domains they are a member of. The domain
strucutre is hierarchical. Here is an example:
- MLB
- AL
- East
- Yankees
- Red Sox
...
+ Central
+ West
- NL
+ East
+ Central
+ West
Now
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 Apr 30
4
acts_as_ordered_tree
I need an ordered (sortable tree) and I just was thinking if somehting
like this is possible:
class Item< ActiveRecord::Base
acts_as_tree :order => "position"
acts_as_list :scope => ''parent_id = #{self.id}''
end
For my understanding mixing of two acts_as should be p?ssible, at least
in this case, right?
Unfortunatly the :scope is not working, I am not
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
2009 Aug 19
10
acts_as_list / acts_as_tree / acts_as_nested_set - which one
I am creating forum application which needs usage of acts_as_list or
acts_as_tree or acts_as_nested_set.
I am unable to decide among these. please could some one recommend from
their experience?
--
Posted via http://www.ruby-forum.com/.
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 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 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
2006 Mar 10
8
multiple sub categories (parent-child)
hi.
base from the cookbook example, where each categories can have many
recipes,
id like the categories to have multiple sub categories, unlimited
levels.
please show some code, as i am new to Ruby and Ruby On Rails.
thanks
--
Posted via http://www.ruby-forum.com/.
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 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
2006 Mar 25
2
acts_as_tree wierdness with children.count and children.size
i am making a category tree and i iterate over the category using my
counter_cache however it would show a different number than what was
actually being represetned in the tree.
Here is an example
cat.children = [cat2, cat3]
puts cat.children.size 2
puts cat.children_count 2
cat4.parent_id = cat.id
cat4.save
puts cat.children.size
2006 Feb 27
1
How to build a recursive parenting structure?
I''m just getting used to using HABTM structures. Something I''m trying
to do now is create a site that has "sections" each section then could
have a sub "section".
So I built a "sections" table and in the model I included the line
"has_and_belongs_to_many :sections"
I also made a table called "sections_sections" to build the
2007 Jan 17
2
rake test and validates_inclusion_of
Hello,
I am just starting off with Rails, so I apologize in advance if there
is a terribly obvious answer to my problem. I''ve done some searching
and found similar problems to my own, but nothing which yielded a
solution.
I have a handful of models that I am unit testing. The tests for each
unit run successfully, but when I do a rake test, many of the tests
fail.
The assertions that
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 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 Jan 05
1
Fixture files for inserting tree like behavior doesn''t work
Hi folks around, hope you could help me with my problem.
I have a porblem while testing my Acts_as_Tree behavior with fixtures.
Because all data in the fixture file will be commited at the end the
entries I want to map my tree like structure to will not be present at
this point. Due to this I get a foreign key constraints fails from the
database. Is there any way to solve this problem?
Here