Displaying 13 results from an estimated 13 matches for "child_id".
Did you mean:
child_pid
2006 May 07
1
Anyone care for a braindump?
...e days that have startdate >= self.startdate AND enddate <=
self.enddate
#
# before after
#
# |=====| |=====|
# <----|--|----> <---| |---->
#
#
@days_inside_new_day = Day.find(:all, :conditions => [ "id != ? and
child_id = ? and startdate >= ? and enddate <= ?", self.id,
self.child_id, self.startdate, self.enddate])
@days_inside_new_day.collect {|d| d.destroy}
# Split days that have startdate <= self.startdate and enddate >=
self.enddate
#
# before after
# |==...
2012 Mar 21
1
Using extract function for dates in sqldf
I'm trying to use sqldf to query for the earliest date of a blood test when
patients have had multiple tests in a given year. My query looks like this:
test11 <- sqldf("select CHILD_ID, min(SAMP_DATE)
from lab
group by CHILD_ID
having extract (year from SAMP_DATE) = 2011")
SAMP_DATE has class "date." I get the error message
Error in sqliteExecStatement(con, statement, bind.data) :
RS-DBI driver: (error in state...
2008 May 27
2
HABTM using two columns
...guide me to docu and code
examples how to create and use a has_and_belongs_to_many relationship
with a joining table where TWO columns are used to identify the
relation to TWO alternative tables.
Example:
table 1: mothers [mother_id, name]
table 2: fathers [father_id, name]
table 3: children [child_id, name]
joining table 4: children_parent [child_id, parent_id, parent_type]
''parent type'' can be either ''mother'' or ''father'', and depending on
this, the ''parent_id'' links to an entry in either the father or mother
table.
How do...
2007 Feb 12
2
Objects in Arrays? Allowed, right?
...I''m trying to manually append objects to an instance variable that is
just an array of objects. Here''s my controller code:
@tasks = Task.find(:all, :conditions => "entity_id =
#{session[:user].id}")
for t in @tasks
if Subtasks.find(:first, :conditions => "child_id = #{t.id}") != nil
@mtasks << t
end
end
However, when I execute, I get an error:
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.<<
Am i incorrectly referencing the object "...
2006 May 09
2
what are all these methods?!?! :)
...tree in the console and I instantiated
a new tree object and went to use the readline support to see all the
available methods and I was rather surprised to see many many more
methods than I was expecting..so I went to the api site and a lot of
them weren''t documented.. .add_children, .child_ids, etc... now I can
guess pretty easily what these methods do and my next step is to go and
look at the source code...but can anyone suggest if i''m missing
something?
--
Posted via http://www.ruby-forum.com/.
2007 Oct 22
1
self-referential habtm: why are my keys null?
...able :nodes do |t|
t.column :name, :string
end
end
def self.down
drop_table :nodes
end
end
class CreateNodesNodes < ActiveRecord::Migration
def self.up
create_table :nodes_nodes, :id => false do |t|
t.column :parent_id, :integer
t.column :child_id, :integer
end
end
def self.down
drop_table :nodes_nodes
end
end
And here is the model:
class Node < ActiveRecord::Base
has_and_belongs_to_many :parents, :foreign_key => :child_id,
:association_foreign_key
=> :parent_id,...
2006 Jan 06
3
Flashing Window in Quicken
...000c: get_window_children_from_point() = 0 { count=1,
children={0x20022} }
000c: start_hook_chain( id=7, event=1, window=(nil),
object_id=0, child_id=0 )
000c: start_hook_chain() = 0 { handle=0x30080, pid=0000,
tid=0000, proc=0x6f1b29, unicode=0, active_hooks=80000101,
module=L"" } 000c:
get_next_hook(...
2005 Jul 21
1
Self-Referencing Tables and Other DB Complexities
...to
self-referencing tables and other more interesting database
complexities?
i.e. Employees table with supervisor_id and mentor_id both
self-referencing Employees on the primary key "id"
or Categories table with relation table (Parent_Child_Categories) with
foreign keys parent_id and child_id both referencing Categories.id
allowing for infinite nesting of many-many related categories
or Supervisors table extending Employees table with a one-one
relationship (Supervisors.id = Employees.id) allowing for storage of
supervisor-specific data
______________________________________________...
2008 Mar 28
0
Problems with URL encoding
Hi
I have a problem when sending parameters from link_to_remote. My link
code:
<%= link_to_remote "Remove",
:url => object_relation_path(
:id => 0,
:object_relation => {
:parent_id => @product.id,
:parent_type => "Product",
:child_id => content_object.id,
:child_type => "ContentObject",
:relation_type_id => 1000
},
:format => :partial,
:response_template => "products/#{@product.product_type}/show/
partials/related_content"),
:update => "related_content_wrapper...
2006 Apr 20
4
Many to Many Category structure with itself
...agory 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). The category_maps table would keep the parent_id/child_id
relationships for the categories table.
As far as the user experience, I want it to work so if you go to
controllername/list_cats (with no id) it will display all cats with a
parent_id of 0. If they go to controllername/list_cats/3 it should
display all cats with a parent_id of 3
My problem is...
2006 Aug 15
0
has_many relationships and minimums
...t
is not saved without at least one child. Question is, is there some
Rails magic to help when removing children to ensure the last one is not
removed? Currently I''m calling something like this in my controller:
unless parent.children.size == 1
@parent.children.delete(Child.find(params[:child_id]))
Is there a more ''Rails'' way to do this?
Tekin
2006 Jul 13
1
How to create a child from a parent
Hi i am trying to figure out what is the best way to do this very basic
thing:
lets say i have two tables: one with parents and one with children.
there is a one to many relation between them.
I scaffolded the parents tabel and i can open each parent. Now i want to
add a link to the ''show'' view which will create a new child record.
In the model i defined the has_many and
2006 Mar 08
0
acts_as_tree circular reference
...fine, except that nothing prevents the user to
create a circular reference:
>> item.parent=child
>> item.save
=> true
>> child.parent=item
>> child.save
=> true
I checked in the database, and there it is: an item that has as parent
its own child!
item.parent_id = child_id
I know I could add code to prevent this from happening, but shouldn''t
that be the job of acts_as_tree ?
--
Posted via http://www.ruby-forum.com/.