similar to: Quick question: making tables without id fields; migrations

Displaying 20 results from an estimated 20000 matches similar to: "Quick question: making tables without id fields; migrations"

2012 Nov 03
0
ids writer fields for HABTM relationship.
Hello forum readers, Let''s say i have two models: Person and Role (i replicated the problem with Post & Tag as well, as i thought the problem was linked to some application-specific rights problem, but it wasn''t). In Person, attr_accessible role_ids is declared, so it accepts an array of Role ids as an argument when creating / updating. If i fire up the rails console and
2006 Jun 09
1
Updating Fields In Migration for HABTM Relationship
Earlier I forgot to add updated_at and created_at columns for my HABTM relationship so I created a migration to add them. In the migration I also want to go back and set the value of the created_at and updated_at columns for the previous rows. What is the best way to do that? Initially I thought I was being smart and decided to put an UPDATE SQL query in a find_by_sql statement and
2006 Apr 03
2
HABTM migrations
Bad rails day for Matt- In a migration, for a habtm: create_table :teams_users do |t| t.column :team_id, :integer t.column :user_id, :integer end Ok, fine. In a controller (well really a migration script): @user.teams << Team.find( 3 ) And the SQL pumped at my server is: INSERT INTO teams_users (`team_id`, `id`, `user_id`) VALUES (3, 3, 34) Which
2006 Apr 20
2
Additional Fields in a Join Table
Hi, I am creating an order management web application, and have run into an issue over join tables. I am reading Agile Web Development and it says that I can put additional fields within my join tables, and they give the example of a date field. I want to know if it is possible to do the following: I have an orders table with the order information as well as an orders_items table and an
2006 Apr 20
5
Using Migrations to convert join table to join model
Greetings, I''m trying to convert a HABTM w/attributes join table in my database into a join model table in order to utilize the new has_many :through functionality introduced in Rails 1.1. Here''s the current table definition: licenses_user_groups: license_id, user_group_id, usage_notes Perhaps it was a mistake, but I made (license_id, user_group_id) the primary key. Now,
2006 May 16
4
Problems with multiple ''id'' columns in a join_table
I have a problem declaring a relationship through a join_table ; the SQL generated by ActiveRecord is correct, but there are two columns called ''id'', and the final object gets the ''wrong'' column ... Here''s a more detailed description of the data, code, and problem :- There''s a People table, with id, name, and a few things. Also a
2007 Jul 06
4
JOINS clobbering ids or other fields.
I just found this ticket because I noticed the same issue. http://dev.rubyonrails.org/ticket/6251 The official response was that it''s not a bug because when you use :joins you are "riding close to the metal". But I''m at a loss as to figure out why this behavior even needs to exist. Every table (except HABTM links) in a typical Rails app is going to have an id
2006 Jul 18
3
DB Migrations & Column Order
Hello, I created a table and about 10 migrations down the line I decided that I needed to add an ID column (this was actually a table for a has_many :through and I recently realized that it needs an ID column, unlike HABTM tables). I am a big perfectionist and I frequently run "SHOW COLUMNS IN table;", so I naturally expect to see the "id" column the first one listed. However,
2006 Feb 25
0
self referential habtm using join tables
All: I have been working on making a self-referential habtm relationship that uses a join model because I want to store info about the relationship. I have been using two sections from Chad Fowler''s "Rails Recipes" as a guide, "Self-referential Many-to-Many Relationships" and "Many to Many Relationships Where the Relationship Itself has Data". So far I have
2012 Feb 09
1
Constraint on one of parameters.
Dear all, I have a function to optimize for a set of parameters and want to set a constraint on only one parameter. Here is my function. What I want to do is estimate the parameters of a bivariate normal distribution where the correlation has to be between -1 and 1. Would you please advise how to revise it? ex=function(s,prob,theta1,theta,xa,xb,xc,xd,t,delta) { expo1=
2008 Jun 11
2
problem with as.Date
Data into R from Excel csv file xd<-read.csv("court.dates1.txt",as.is=T, header = F) > str(xd) 'data.frame': 5 obs. of 1 variable: $ V1: chr "6/6" "5/27" "5/16" "5/2" ... >xd V1 1 6/6 2 5/27 3 5/16 4 5/2 5 4/29 cdates <- as.Date(xd, format = " %m/ %d") Error in as.Date.default(xd, format = " %m/
2006 Mar 13
3
HABTM: two habtm''s between the same two tables
Imagine I want to track people, and the clubs that they belong to. table people with columns person_id, person_name table clubs with columns club_id, club_name And I have the association table: table clubs_people with columns person_id, club_id Now I know how to do this habtm between the two, in order to associate people with clubs that they belong to. However my application also needs a
2006 Feb 26
1
noob question on deleting from join tables
When I have a habtm association between two models (User & List), implemented thru a join table users_lists, there are a variety of ways to "delete" associations between specific User<->List combinations. ActiveRecord lists delete, clear etc. However, these methods all operate by setting foreign keys in the join table to nil and do not remove rows from the join table.
2004 Jun 30
1
Smb PDC cracks with ldap, without ok
Hi everybody I have a puzzling situation, I am trying to set up a PDC domain controller, Suse 9.1 with Samba 3.0.4 (ok, suse comes with 3.0.2 but I have tried almost everything XD ), autenticating against ldap 2.2.6 (original suse); also with the smbldap-tools. The situation is, everything works fine without ldap, that is, smbpasswd backend, I did create the directories for profiles and I
2004 Jul 30
1
plot(x,y) core dump
Dear R Development Team, I compile R-1.9.1 on AIX 5.2 under 2.9-aix51-020209, and xlf 7.1. In order to let R compile successfully under gcc 2.9, I have to change one C statement of file(RHOME//src/modules/X11/devX11.c) line 1768 from "retrun FALSE" to "retrun NULL", following is C code snapshot: newX11Desc * Rf_allocNewX11DeviceDesc(double ps) { newX11Desc *xd;
2006 Jun 04
0
[SUMMARY] Rails Core Weekly May 29 - June 4
Rails Core Weekly May 29 - June 4 Dear List, Another week has passed, here''s RCW, the McCartney Edition: This weeks kicks of with Josh Susser fixing has_and_belongs_to_many #create method to properly populate joins with new records :http://www.ruby-forum.com/topic/67478#new. Check out his test: def test_create_by_new_record devel = Developer.new(:name => "Marcel",
2001 Dec 05
9
Windows testing
R 1.4.0 is now sinking into feature freeze, and we'd like some help testing it under Windows. Duncan Murdoch and Uwe Ligges have already volunteered. I've put a copy of SetupR140.exe at http://www.stats.ox.ac.uk/pub/bdr/RWin Also in that directory is a file TESTING suggesting some tests, not all of which have been run on this build. As the graphics internals have been changed a lot
2000 Sep 22
3
eval functions... (PR#668)
Full_Name: Anantha Prasad Version: 1.1.1 OS: Linux Submission from: (NULL) (199.131.134.30) I am trying to convert some S-PLUS code to R (a tcl/tk application that uses R)... here is the error I got in R (but not in S-PLUS)...so I am wondering if it is a bug. Eg., the foll. extract from a function runs fine in S-PLUS but gives the error: Error in x[[j]] : subscript out of bounds in R code
2010 Dec 17
3
Alternative to extended recode sintax?
Dear R-users, I have a factor variable within my data frame which I derive week after week from a POSIXct variable using the cut(var,"weeks") command I have found in the chron package. The levels() command gives me: [1] "2009-03-30 00:00:00" "2009-04-06 00:00:00" "2009-04-13 00:00:00" "2009-04-20 00:00:00" "2009-04-27 00:00:00"
2006 May 18
3
Model Madness: habtm vs through
This has me scratching my head: a Person has many Things a Person has many Collections a Collection has many Things ...Things in a Collection are ordered ...Things in a Collection can be related to (created by) any User ...a collection has additional attributes, such as a name etc I am confused about habtm in rails (especially when using acts_as_habtm_list) vs. going the :through route.