similar to: Nested Set question

Displaying 20 results from an estimated 90000 matches similar to: "Nested Set question"

2007 Jan 13
0
better nested set 0.1
We are pleased to announce the 0.1 release of the plugin betternestedset. It greatly enhances ActiveRecord''s internal acts_as_nested_set. Install it with: script/plugin install svn://rubyforge.org/var/svn/betternestedset/tags/stable/betternestedset Join the mailing list: http://rubyforge.org/mailman/listinfo/betternestedset-talk Report bugs:
2009 Oct 14
0
[PATCH server] hack betternested set to enable pool deletion
This is an ugly hack to fix the betternestedset plugin as currently a bug does not allow pools to be deleted. The single line commented out in this patch deletes the pool itself instead of only its children for whatever reason. This wouldn't be a problem were it not for the recent change to active record which enforces optimistic locking upon destroy operations. Since the database record is
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
2008 Mar 07
4
n-levels of nested resources in REST?
Hi, I find it would be very convenient to nest resources in two levels, so a member is only sensible as a part of a club, and a fee pament is only sensible in the context of a club and a member. Is it possible to nest nested resources? How would the syntax be? I have tried just nesting the assignment in routes.rb, but failed to get it right What do ou think? Is it possible? /Fredrik --
2007 Apr 29
1
better nested set and :through
Hello all, It''s been a while since i''ve been doing any rails development, so i''m a bit rusty. Having found this: http://opensource.symetrie.com/api/better_nested_set/ it looks really interesting and useful for solving something i''m trying to get working. What i have (essentially) is the following models: class Group < ActiveRecord::Base
2007 Nov 30
2
Nested resources and _path methods
Hi guys, I was thinking aboiut this for a while: If I have nested resource routes, for example /building/1/floor/2/ room/ 3 (building has_many floors and so on), I have to call the room_path method like this: room_path @room.floor.building, @room.floor, @room Isn“t there a better way to handle nested routes with foreign keys, or can I have this method overwritten somewhere? Greets Jonas
2007 Mar 17
0
Unit test problem -- BetterNestedSet?
After adding validates_uniqueness_of :login_name to a User model that acts_as_nested_set using BetterNestedSet, my unit tests started failing. On investigation, I found that valid? wasn''t true for the records in question after they were created. Running the exact same sequence of tests by hand in the console -- creating records, then calling move_to_child_of on them -- works fine. If
2008 Jul 11
1
Using custom routes to handle new nested resources
I have a couple of resources, one nested in the other, such that my resource spec in routes.rb is: map.resources :parents, :has_many => :children This will generate a route for a new child that assumes that the parent has already been saved, something like: /parents/:parent_id/children/new But what if I want a route that handles the case where the parent resource is also new, and thus
2008 Mar 12
2
nested routes with a 2-way has_many using join table?
I have two classes, InstructionalObject and Assets. They both have_many of the other, implemented through a join table (so it''s like a habtm without the habtm). For the next version of our app, we''re refactoring to RESTful, and i''m having trouble with my nested resources/routes. I tried this, in routes.rb: map.resources :assets do |assets| assets.resources
2008 Nov 05
2
AJAX - REST & nested resources
I''ve created a set of resources, with scaffolds that all work. I then changed one resource to be nested inside another as a one to many relation. This required a little bit of work on the tests, the controllers and the views but it all works. Now I want to go the extra step and have the child resources become updateable inside the parent form. I''ve pushed the formatting of the
2007 Aug 03
1
Nested Resources vs. Normal Resources
Hi, I''m a bit unsure as to when one uses a nested resource and when one uses a normal resource. If you have a belongs_to, has_one/many relationship between models is that automatically an indication of a nested resource or can these resources still be represented in the normal resource way? I have a resource (talker) that belongs_to a number of other models (network, data_date,
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
2008 Aug 28
0
How to handle nested and not nested resource in an action's controller?
Hi list, I don''t know whether the subject is understandable / what i really mean. I have a model which resources are nested and non-nested (CMIIW). Anyway, my routes.rb should explain: map.resources :speeches, :collection => { :upload_file => :get } map.resources :bundles do |bundles| bundles.resources :speeches end How to handle an action in SpeechesController,
2007 Aug 02
1
Foreign Key Use
Hi can any1 guide me ,How can i use foreign Key concept in rails, I m using Migrations to create tables, Also i want to know diffrent fields we can use while creating tables. I mean like String,Date time, timestamp,,,,Plz tell me various fields so that i can Make proper use of them as per requirement. Thank u in advance -- 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
2009 Feb 03
1
update_attributes! does not update nested model
Hi! I have updated my app to rails 2.3. I have form that has few nested models and I am happy that I can just write accepts_nested_attributes_for :tasks, :allow_destroy => true, but update_attributes! does not update my nested model. I have tried update_attributes, and it works. Any ideas? Few lines from log: update_attributes: SQL (0.1ms) BEGIN Education Update (0.3ms) UPDATE
2007 Jan 10
0
nested resources with nested controllers
Is there a way to create resources that work with nested controllers? For example: ./script/generate scaffold_resource project name:string mkdir app/views/layouts/project # so the command below doesn''t complain ./script/generate scaffold_resource project::user name:string # routes.rb map.resources :projects do |project| project.resources :users end After creating a project
2007 Aug 16
1
Nested REST resource routes without controller name
I am curious if the following URL pattern is appropriate to use with REST and map.resources: Let''s say I want to build a website with information about cars. I decide that there will be a page to view/manage cars by model. The route for this is easily created: map.resources :cars The URLs look great. But now I want to introduce the ability to specify cars by year. I can do this by
2009 Mar 26
0
Rails 2.3.2 nested forms, option_groups etc
Working in 2.3.2 and working from the examples in Github for nested forms, this works fine for simple text fields, or simple selects but option_groups_from_collection_for_select is a bit more complicated. The js code he''s used generates a template to be used for each nested form, but it does it in the simple example by using a f.select helper. This will generate the correct html for the
2009 Jun 01
0
Nested models and forms
Hi, I have been trying to use the new nested models & forms feature in rails 2.3 #helper def add_job_profile_link(name, form, vacancy) link_to_function name do |page| profile = render(:partial => ''job_profile'', :locals => { :f => form, :job_profile => vacancy.job_profiles.build }) page << %{