similar to: HABTM using two columns

Displaying 20 results from an estimated 120 matches similar to: "HABTM using two columns"

2012 Oct 10
7
multiple t-tests across similar variable names
Hi everyone- I have a dataset with multiple "pre" and "post" variables I want to compare. The variables are named "apple_pre" or "pre_banana" with the corresponding post variables named "apple_post" or "post_banana". The variables are in no particular order. apple_pre orange_pre orange_post pre_banana apple_post post_banana person_1
2007 Feb 12
2
Objects in Arrays? Allowed, right?
Hi: 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
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
2006 Jul 20
2
a rails model question
Hi all, I am a newbie in ruby/rails. I have a question about my database model: table1: entities (name, description, author_id ...) table2: relations (source_id, target_id, relation_type) (it describes the relations between 2 entities and the relation type) How can I define models using rails, or do I need to redefine my database schema? thank you -- Posted via http://www.ruby-forum.com/.
2005 Jul 21
1
Self-Referencing Tables and Other DB Complexities
How well does Rails deal with ActiveRecord classes mapping 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
2006 Apr 20
4
Many to Many Category structure with itself
Basically, I''m trying to have a table called "categories" have a many to many relationship with itself. But I also want each catagory 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).
2011 Jan 19
6
rake aborted! can't convert Hash into String
Hello, I encouter a problem when i try to do "rake db:migrate": rake aborted! can''t convert Hash into String Here is the trace result: ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! can''t convert Hash into String /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1408:in
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
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",
2006 May 07
1
Anyone care for a braindump?
I have this problem with records that have to be alligned on end- and startdate. I came up with the following. but am not convinced that this is the best way to tackle this problem. Anyone care for a braindump? def head_to_tail # Remove days that have startdate >= self.startdate AND enddate <= self.enddate # # before after # # |=====| |=====|
2007 Oct 22
1
self-referential habtm: why are my keys null?
I''m trying to set up a directional self-referential HABTM to represent an arbitrary semi-hierarchical structure; it works for any data prepopulated into the db, but when I try to create a new relationship, I just get NULLs in both key columns (or 0''s if I turn on the no-null constraint). Here are the migrations: class CreateNodes < ActiveRecord::Migration def self.up
2006 Jan 06
3
Flashing Window in Quicken
Wine version: all Linux version: Fedora 3 and Gentoo 2.6.14 Symptom: When running quicken, opening the "Split costs" dialog causes the program to go into an infinite loop, flashingthe window to proper size then minimized and back again, as fast as the display will allow. It appears that the window is opened and the program attempts to flash the caret but access is denied to
2006 May 09
2
what are all these methods?!?! :)
I''ve been happily riding the Ruby/Ruby on Rails learning curve .. I bought the pickaxe book, first and beta second editions of the agile book and i''ve been using the api.rubyonrails.com but i''ve come across something which as stumped me I''m fooloing around with :acts_as_tree in the console and I instantiated a new tree object and went to use the readline
2006 Aug 12
10
adding extra variable to a class, how to access it?
somple question here but pretty confusing on my side. i have a model towns that is mapped to my towns table. can i add an extra variable to the class and access it in my view? basicall what i am trying to do is return a list of towns, and next to each town, display a total number of what i have in each town. ive tried both attr_reader and @total but no avail. here is my view <% for
2006 Aug 15
0
has_many relationships and minimums
Hi, New to Rails and the list. Quick questions regarding has_many relationships that require at least 1 child. I''m aware of validate_size_of and use this to make sure that the parent 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
2006 Mar 08
0
acts_as_tree circular reference
my application is using acts_as_tree to create a directed graph. Everyone would work 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
2009 May 15
0
[PATCH server] use service layer for Network controller.
There's still room for additional refactoring as we may want to eventually split out nic, bonding, and ip address manipulation into their own controller/svc module, but that would be a much more extensive redesign than we want to deal with for the overall service layer creation refactoring. Signed-off-by: Scott Seago <sseago at redhat.com> --- src/app/controllers/network_controller.rb
2010 Jul 16
6
Lost zpool after reboot
Hello, I have a dual boot with Windows 7 64 bit enterprise edition and Opensolaris build 134. This is on Sun Ultra 40 M1 workstation. Three hard drives, 2 in ZFS mirror, 1 is shared with Windows. Last 2 days I was working in Windows. I didn''t touch the hard drives in any way except I once opened Disk Management to figure out why a external USB hard drive is not being listed.
2009 Sep 23
0
[PATCH server] consolidated network & routing info ui's
created/edit network information is all specified on one simpler form --- src/app/controllers/network_controller.rb | 27 +++++++++++++++---- src/app/models/bonding.rb | 2 +- src/app/models/network.rb | 2 +- src/app/models/nic.rb | 2 +- src/app/views/network/_form.rhtml | 15
2006 Sep 21
3
:order by association field
Hi. I''m trying to do something that should be a fairly common pattern, but I''m currently not sure how. BACKGROUND: model Family has_one Father. also, Family has field "country_of_origin" model Father has a number of fields, such as first_name, age, etc. It''s easy to sort based on families'' fields: sorted_families = Family.find(:all, :order =>