search for: children_count

Displaying 9 results from an estimated 9 matches for "children_count".

2006 Mar 24
6
Should counter_cache fields be saved in the database?
...the following schema, dumped from sqlite3: CREATE TABLE children ("id" INTEGER PRIMARY KEY NOT NULL NOT NULL, "name" varchar(255), "parent_id" integer, "deleted_at" datetime); CREATE TABLE parents ("id" INTEGER PRIMARY KEY NOT NULL NOT NULL, "children_count" integer DEFAULT 0, "name" varchar(255)); CREATE TABLE schema_info (version integer); CREATE UNIQUE INDEX children_id_index ON children (id); CREATE UNIQUE INDEX parents_id_index ON parents (id); I would expect the children_count column in each Parent to be populated with the number...
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 acts_as_list :scope => :parent_id end A...
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 2 puts cat.children_count 2 however cat.children.count produces the correct number (3) what gives? Thanks, Mark -- ----------------------------------------...
2006 Feb 03
2
acts_as_tree counter_cache behavior is different than API docs
Before I file a ticket, I''ll query ya''ll about this: The API docs for acts_as_tree''s counter_cache is to create a database column called "children_count" to hold the counter_cache. I have enabled this option in my model. While writing tests I wrote a test for creating children from the a parent: message = @forum_message["parent"].find child = message.children.create( "member_id" => 1, "forum_id" => 1...
2005 Mar 01
0
acts_as_tree counter_cache
...f but I thought "then why have a configuration option?" Also, speaking about the documentation at http://rails.rubyonrails.com/classes/ActiveRecord/Acts/Tree/ClassMethods.html#M000277 it wasn''t too clear (for me at least) that the counter_cache column shouldn''t be named children_count, but rather classname_count (refering to "counter_cache - keeps a count in a children_count column if set to true (default: false).") Thanks for the ear! Earnestly, Caleb
2016 Apr 29
2
Panic: file message-part-serialize.c: line 90 (part_serialize): assertion failed: (part->children == NULL)
...:275 ctx = {type = LOG_TYPE_PANIC, exit_status = 0, timestamp = 0x0, timestamp_usecs = 0} args = {{gp_offset = 40, fp_offset = 48, overflow_arg_area = 0x7ffdac80a360, reg_save_area = 0x7ffdac80a2a0}} #5 0x00007fa88bfad1bf in part_serialize (part=0x7fa88e5ead90, dest=0x7fa88e583890, children_count_r=0x7ffdac80a3e0) at message-part-serialize.c:90 count = 1 children_count = 0 children_offset = 84 root = false __FUNCTION__ = "part_serialize" #6 0x00007fa88bfad163 in part_serialize (part=0x7fa88e5eab30, dest=0x7fa88e583890, children_count_r=...
2006 Aug 06
2
better_nested_set plugin
...being level 0 * ancestors - array of all parents, with root as first item * self_and_ancestors - array of all parents and self * siblings - array of all siblings, that are the items sharing the same parent and level * self_and_siblings - array of itself and all siblings * children_count - count of all immediate children * children - array of all immediate childrens * all_children - array of all children and nested children * full_set - array of itself and all children and nested children Subversion repository: http://opensource.symetrie.com/svn/better_nested_set...
2013 Nov 18
1
wrong number of arguements (1 for 0) on ActiveRecord::Base#send
...to the database and ready to go. But a problem occurs when I try to call methods on it with BasicObject#send. I take a list of fields from a yaml file (user supplied) then attempt to update the fields with BasicObject#send. yaml file example - content: some content parent_id: 1 children_count: 0 etc. So my code ends up like this: model.send(''content'', ''some content'') And it blows up with an error: ArgumentError: wrong number of arguments (1 for 0) /home/zatz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.1 /lib/active_rec...
2006 May 31
1
Help enhancing acts_as_nested_set
...#{right_col_name} - #{size} )", "#{right_col_name} >= #{right_bound}" ) end self.reload self[parent_column] = new_parent self.save } end # Returns the number of nested children of this object. def children_count return (self[right_col_name] - self[left_col_name] - 1)/2 end # Returns a set of itself and all of its nested children def full_set self.class.find(:all, :conditions => "(#{left_col_name} BETWEEN #{self[left_col_name]} and #{self[right_col_name]})&...