Displaying 20 results from an estimated 2000 matches similar to: "Awesome nested set - how to put there items?"
2006 Jul 18
1
Bad values for acts_as_nested_set?
I moved from acts_as_tree to acts_as_nested_set because I need the
all_children method.
I''ve seen an alternative way to add this method to acts_as_tree here:
http://www.chuckvose.com/articles/2006/05/24/recursive-children
But I''d prefer to use the more efficient way of acts_as_nested_set (and
not to have to revert to my old code).
Anyway, here''s my issue: if I
2010 Mar 08
0
betternestedset in rails 3.0
Hi Guys,
when i upgraded my rails 2.3.4 to 3.0 my betternestedset is not working.
It was working fine in the older version. This is my controller
def new
cat = Category.new
cat.text=''test''
cat.save
cat.move_to_child_of(Category.find_by_id(1)) #26
redirect_to :action => ''index''
end
It gives me this error : "You cannot move a
2006 Mar 15
5
acts_as_threaded - help ???
Hi, has anyone successfully used the acts_as_threaded plugin with
postgresql?
I''m using rails 1.0 and ruby 1.8.4 on linux.
Following the screencast on
http://www.railtie.net/articles/2006/02/05/rails-acts_as_threaded-plugin ,
I got to where we''re ready to create our first post, having made the
changes to controllers/posts_controller.rb, views/posts/_form.rhtml,
2005 Oct 12
2
Help with act_as_nested_set
Hi, I''m trying to get act_as_nested_set working, and I''m puzzled.
I googled the following
http://codefetch.com/cache?url=http://media.pragprog.com/titles/rails/code/r
ails-code.tgz
<http://codefetch.com/cache?url=http://media.pragprog.com/titles/rails/code/
rails-code.tgz&path=rails-code/ar/acts_as_nested_set.rb&lang=ruby&qy=ruby>
2006 May 31
1
Help enhancing acts_as_nested_set
I''m trying to enhance acts_as_nested_set. Well actually I already have,
but I''ve done a hack up job of it. I would like to contribute these
enhancements back, but I need a little help.
I''m a complete newbie to this stuff. The only thing I new before coming
into this project was vanilla HTML. So over the course of two weeks I''ve
picked up Ruby, Rails, MySQL,
2010 Aug 01
0
Picking Part of Large R Object
Dear All,
I have imported an HTML document to R (called tables) and wish to select
certain pieces of it for processing. The first few lines of the object
appear as follows:
> tables
[[1]]
<table id="fs-table" class="gf-table rgt">
<thead>
<tr><th class="lm lft nwp">
In Millions of USD (except for per share items)
</th>
<th
2005 Mar 08
1
To convert an adjacency list model into a nested set model
Dear R-help
I am wondering if somebody wrote some code to convert an adjacency list
model into a nested set model.
In principal I want to do the same as John Celko mentioned it here with
SQL:
http://groups.google.co.uk/groups?hl=en&lr=lang_en&selm=8j0n05%24n31%241
%40nnrp1.deja.com
Assume you have a tree structure like this
Albert
/ \
/
2009 Feb 20
0
Nested set - problems when creating child item
Hi,
I''ve created a Model with Better Nested Set, but i''m having problems
to create child items
My workflow is:
- In the (new) form, i pass the desired parent_id in a hidden field.
- In the create action, i create the register and after saving it i
use the move_to_child_of method.
Everything works! My only problem is that Rails warns that I can''t
mass asign the
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 Jun 02
2
Sticky Options to Find?
Is there a way to provide "sticky" options to ActiveRecord::Base::Find ?
I''m thinking something with a use model like:
class Function < ActiveRecord::Base
sticky :conditions => "lft > 0", :order => "lft ASC"
end
Where all subsuquent find operations have those options applied. In this
case:
Function.find(:all)
Would actually be equivalent
2009 Feb 20
1
better nested set and parent_id
Hello everybody
I have a model with better_nested_set. In my "new" form, i pass the
desired parent_id as a hidden field, and in the create action at the
controller i save the new register and use move_to_child_of Model
(params[item][parent_id])
Everything works, but at my log file it warns that i can''t mass asign
the property "parent_id".
What can i do to avoid the
2007 Jan 31
2
has_many :conditions
Is it possible to put conditions relative to the current instance in
has_many''s :conditions?
For example, in a forum app:
class Post < ActiveRecord::Base
belongs_to :topic
has_many :self_and_descendants, :class_name => "Post", :order =>
"lft",
:conditions => "topic_id = #{topic_id} AND (lft BETWEEN #{lft} AND
#{rgt})"
end
With the
2006 May 12
2
Has many through join table issues
I''m trying to wrap my caffeine soaked brain around has_many :through
following along at:
http://rails.techno-weenie.net/tip/2005/12/23/teaching_your_blog_model_new_tricks_with_has_many_through
I think my models are a little more complex than what fits this
narrative.
I have a directory of members, each member can belong to multiple
categories.
The category table references itself
2006 May 10
1
acts_as_nested_set does not work (in my case).
Hello,
I am using acts_as_nested_set. My problem is that the columns "lft" and
"rgt" get the value 0 if I create a new entity. If I delete an entity I
get negative values (-1, -2, -3) - but for all entities. Is there
anything missing? Is there any example for "acts_as_nested_set" in the
web?
--
Posted via http://www.ruby-forum.com/.
2009 May 22
1
[PATCH server] fix for BZ #477796: pool name uniqueness
We already had the validation rule in place, but the way the betternestedset API sets the parent_id the rules were being bypassed.
Signed-off-by: Scott Seago <sseago at redhat.com>
---
src/app/models/pool.rb | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/app/models/pool.rb b/src/app/models/pool.rb
index 2979fcb..0a63723 100644
--- a/src/app/models/pool.rb
2007 Jul 18
10
Rails - Mock going out of scope?
Hello list,
I think I have a rails related RSpec problem with a mock going out of
scope on a recursive call to a model.
The code is at: http://pastie.textmate.org/79821 if you want to see it
highlighted. I have pasted it below as well.
Basically, I have an acts_as_nested_set model called "Node", which
works fine. I have a function which finds the language name of the
node instance.
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 Aug 05
0
Finding by inclusion in nested set
Say I have tasks with a belongs_to association to categories where the
later act as a nested set. Now I want to find all tasks belonging to a
specific category (given as primary key) or any of its sub-categories.
SELECT tasks.*, tasks_category.name
FROM
categories AS nested_set_categories, tasks
LEFT OUTER JOIN
categories AS tasks_category
ON
tasks_category.id = tasks.category_id
WHERE
2006 Apr 29
2
counter_caching clobbered when preloading association ?
Hi,
I''m trying to use counter caching in a tree structure (in this case Bob
Silva''s threaded list). This is the definition:
class Folder < ActiveRecord::Base
acts_as_threaded
has_many :files
end
I would like each parent to have the total count of all the childrens
member. So when inserting a new file I update the file_count following
the parent_id through all the
2010 Jan 25
9
skinny Controllers, fat models with REST?
Hi,
I''m really new to rails, so i programmed some stuff and today i read
some things about skinny Controllers, fat models.
My Controllers are really fat now. So i''m asking myself how can i
shrink my controllers and move the code to the models, especially in
fact of REST e.g. in focus on error codes?
code example:
# POST /tasks
# POST /tasks.xml
def create
@authorized