similar to: has_many: inserting children when inserting parent

Displaying 20 results from an estimated 900 matches similar to: "has_many: inserting children when inserting parent"

2006 Dec 28
0
Localization using inheritance
Hi! I''m trying to implement localization using inheritance, i.e.: class ParentController < ApplicationController layout "mylayout" def initialize #do something end def index #do something end def search #do something end # ... end Controller do his job and render page using "mylayout" and views from "/view/parent"
2006 Jan 09
6
drag and drop problem
I am working on a resource planning problem. I like to use a nice drag and drop interface for that. E.g. have a box of persons and a box of projects, now I would like to assign a persom to project by dragging it from the available resources box to a recieving project box. I have studied the amazing drag and drop shopping card code listed here http://demo.script.aculo.us/shop What I need to
2006 Jun 03
2
Parent listing children.
My database is set up as Categories > Things associated by category_id and has_many and belongs_to. How would I go about listing all the categories and under each Category is it''s children? Is there an easy rails way to do this - preferably without using acts as tree? Any help is appreciated - thanks! -- Posted via http://www.ruby-forum.com/.
2006 Apr 15
0
parent.children not updated (has_many)
Hi guys! class Parent < ActiveRecord::Base has_many :children end class Child < ActiveRecord::Base belongs_to :parent end I do: parent = Parent.find(1, :include => :children) parent.children.find(3).update_attribute(''name'', ''Tom'') (or parent.children.find(3).name = ''Tom'') parent.children.find(3).name => ''old
2006 Jan 25
0
acts_as_tree validation on parent.children.create
Validation does not appear to execute on a call to "parent.children.create". Anyone know if this is intentional, or am I doing something wacky? Thanks. -Theo
2006 Jan 31
2
How can I overwrite the parent.children.push(child) Method?
Hi all I want to overwrite the push method (which is an alias of <<, the same as concat) of collections, and there I want to test if :uniq is set to true in the relationship. If so, the method should check if the passed object is already related to the parent, or not (only then it will be added). But I just can''t find the original code of this method, so I could overwrite
2007 Nov 16
0
ZFS children stepping on parent
I was doing some disaster recovery testing with ZFS, where I did a mass backup of a family of ZFS filesystems using snapshots, destroyed them, and then did a mass restore from the backups. The ZFS filesystems I was testing with had only one parent in the ZFS namespace; and the backup and restore went well until it came time to mount the restored ZFS filesystems. Because I had destroyed
2007 Jan 23
0
validates_presence_of fields. in parent ok, but how in children?
i have the problem that my child class fileds aren''t validated on saving the parent. working with parent and child works without problems. if all fields are filled correctly everything is saved as expected. but missing fields in the child arent added to the errors. following short sample shows what i try: Model ----------------------------------------------------- class Parent <
2006 Jun 13
4
When saving parent fails, children will still be updated
Hi all, When submitting a master/detail form I first want to handle the children before saving the parent. There are has_many and belongs_to relations between the parent and the children, so I can edit the children using (psuedo-)code like: child.destroy for deleting, child.update_attributes for updating and @parent.children.push(child) for adding child-records. I update the parent by using:
2006 Dec 07
2
Problem saving parent and children using belongs_to, class_name, and foreign_key
Hi, I have a real simple association setup here that''s just trying to: - Create a new PayjunctionOrder - Create some LineItem objects and assign them to the PayjunctionOrder - Save everything I''m using Rails Edge. ---- class PayjunctionOrder < ActiveRecord::Base has_many :line_items end ------------------ ---- class LineItem < ActiveRecord::Base belongs_to :order,
2007 Nov 02
0
[PATCH] PVWin: Fix warnings
This patch cleans up some 80-odd warnings I was seeing when compiling the xenpci driver, all completely trivial. It also replaces the use of asm for calling cpuid with the __cpuid compiler intrinsic, and modifies calling code accordingly. I''m pretty sure my mailer going to mangle the inline patch (below) so I''m attaching the pristine version. (will try to fix for next time) --
2010 Apr 13
5
How to check if a parent has children?
What is the new way to check if a parent has child items? In rails 1.2.6 I did this: if @client.has_line_items? Client being the parent and line_items the children. Now that I have upgraded to rails 2.0.1 (on my way to current :-) ) I am getting this message: undefined method `has_line_items?'' for #<Client:0x7f3b093b01a0> How should I format the query now? Regards, Paul
2002 Oct 21
9
help, a children can not borrow from a parent?
Hi ; MY script: tc-htb3 qdisc del dev eth2 root ipchains -F tc-htb3 qdisc add dev eth2 root handle 10: htb default 20 r2q 40 tc-htb3 class add dev eth2 parent 10: classid 10:1 htb rate 50Mbit burst 2000 tc-htb3 class add dev eth2 parent 10:1 classid 10:100 htb rate 12mbit ceil 50mbit prio 1 tc-htb3 class add dev eth2 parent 10:1 classid 10:20 htb rate 38mbit ceil 50Mbit prio 8 ipchains
2006 May 30
0
Order parents when displaying children question
Hi, I want to show a series of links belonging to a specific category. The links will be shown grouped by category, but how can I alter the order of the categories? I have a field in my database called position with the order in which they should appear. MODELS: class Category < ActiveRecord::Base has_many :links validates_uniqueness_of :category, :message => "already
2008 Jan 02
1
wants to get all parents with no children, etc
To all: hi, i have implemented the associations in my models so i have a Parent model that has many Children model but i need to get a list of Parents that do not have children or Parents that have just 2 children or Parents that have children whose name is ''James'', or ''Sarah'', or ''Betty'' or Parents whose children do not have names like
2007 Feb 14
3
eager loading parents and children (acts_as_tree)
I am struggling with how to do eager loading of an acts_as_tree model. If the model Stuff acts_as_tree I know I can do this to get children as well: Stuff.find(:all, :include => :children) But what if the model I am including is the one that acts_as_tree? For example, say Picture belongs_to Category. Category acts_as_tree and I want to get all pictures that are members of a category that
2018 Apr 06
1
Question: Samba and YP-Yellow Pages relation.
Hai, Someone called me called?? I did a quick read here in this thread.. The upn part is done, so your almost there. You need to make sure your DNS is working as it should. To check on the proxy with dig a hostname.FQDN. dig -x ip_the_server Test this for the DC hostnames/ips also. If that all ok, you can try these settings in squid # For squid ( works for me as of squid 3.2 up to 3.5
2008 Jul 09
1
childNames for xaxis grob (grid package)
Dear list, Can someone explain why the childNames below gives character(0) instead of the (canonical) names of the children grobs of the xaxis gTree ? [1] "major" "ticks" "labels" Many thanks in advance, Tobias ### minimal example code ### library(grid) pushViewport(plotViewport(c(5,4,4,2))) pushViewport(dataViewport(1:5, 1:5)) grid.points(1:5, 1:5)
2018 Apr 11
0
Question: Samba and YP-Yellow Pages relation.
Hai Fabricio, > Hello Louis, > I did all the tests and they worked, but here some questions. > > When using the wrapper with samba47, I see the squid tries > Kerberos, if it doesn't work, it goes for NTLM. Yes and no, read on you see why i say yes and no.. > If I use the wrapper for a machine that is NOT on a Domain, > it just fails, which is fine because the
2006 Jan 18
5
Inserting the parent Id to the child table
Hi All, I need your suggestions for the following. I am still learning RoR and pardon my ignorance. I have say two tables. Table A : students Table B : addresses Table B has student_id as the foreign key to Table A If I am displaying the list of students and wanted to get individual students addresses based on their id, is the only option is to get the id from students controller method list