Displaying 20 results from an estimated 10000 matches similar to: "Eager loading and :order produces ambiguous column error"
2006 Jan 22
2
suggest for "ambiguous column" when JOIN associated tables
Today I face with incorrect behavior in ActiveRecord.
It take place when I try to use :include parameter for .find method.
Where are two typical cases:
1. You have record with self-referential joins
CREATE TABLE keywords (id, group_id);
class Keyword < ActiveRecord::Base
belongs_to :group,
:class_name => "Keyword",
:foreign_key =>
2006 Jul 31
2
ambiguous column name in has_many :through
In my application model I have three classes: Accounts, Projects, and Items
class Accounts < ActiveRecord::Base
has_many :items, :through => :projects, :source => :items
has_many :late_items, :class_name => ''Item'', :through => :projects,
:conditions => [''due_on < ?'', Time.now], :source => :items
end
class Projects <
2006 Nov 13
1
Removing column default with a migration
Hi guys,
I''m having problems removing the default from a boolean field. I''m using the
following statement:
change_column :valuations, :too_many_adults, :integer, :null => true
but it''s adding DEFAULT ''0'' to the SQL statement. I''m having no luck using
change_column_default either. Is this possible?
Gareth
2006 Jul 31
0
Patch for #3438: Eager loading doesn''t respect :order of associations
Hello all,
I still have a patch for #3438 (eager loading doesn''t respect
association orders); it passes all unit tests, and has additional unit
tests with full coverage. The patch is attached.
== The Bug ==
Author.find(1).posts != Author.find(1, :include => [:posts]).posts
if Author has_many :posts, :order => anything.
This means that either one must avoid eager loading or
2006 Feb 12
3
Error when Eager Loading "Not unique table/alias"
Hi list,
I get the error "Not unique table/alias" (myql 4.1) when trying eager
load 2 classes that use the same base class (not STI)
Example:
<code>
class Wedding < ActiveRecord::Base
belongs_to :bride, :class_name => ''Person'', :foreign_key => ''bride_id''
belongs_to :groom, :class_name => ''Person'',
2004 Oct 05
1
QOS on each interface
I have a firewall with 3 interfaces DMZ, INTERNET, LAN.
Does anyone have an example script to do QOS on multiple intefaces using
htb?
Gareth Segree
mailto:Gareth.Segree@gleanerjm.com <mailto:Gareth.Segree@gleanerjm.com>
Technical Support Analyst
The Gleaner Company Ltd.
7 North Street
Kingston
Tel: 922-3400
2006 Sep 13
1
Eager loading with acts_as_tree
So I have a model that acts_as_tree and I run a method on a collection
of all of these records. This method walks the tree and fetches the
parent/children, etc. This results in many, many duplicate SQL queries
to be executed. Is there a way to eagerly load all of these models?
Something along the lines of:
Model.find(:all, :include => [:children, :parent])
If I execute the above statement, I
2008 Aug 05
2
95% CI bands on a Lowess smoother
Hi there,
I'm plotting some glass RI values just by plotting
plot(x)
then I put on my lowess smoother
lines(lowess(x))
now I want to put on some 95% Confidence Interval bands of the lowess
smoother, but don't know how??
Thanks
--
Gareth Campbell
PhD Candidate
The University of Auckland
P +649 815 3670
M +6421 256 3511
E gareth.campbell@esr.cri.nz
gcam032@gmail.com
[[alternative
2008 Aug 13
2
Naming dataframes, vectors etc within a loop
Hi there,
I know this is probably a really simple question, but without the correct
keywords, or knowledge of the correct function it is hard to search for on
the net or within R.
How do I increment a dataframe (or similar) name within a loop and assign
data?
A simple example would be:
for(i in 1:10){
test<-i
}
BUT I want it to be test[i] --- in other words I want my stored data to
2008 Aug 10
2
ANOVA help
Hi,
I'm doing anova on a matrix of multivariate data where I want to assess the
effect of each column (element).
My matrix is 86 rows x 31 columns. I've created a grouping factor of length
86 containing group assignments of 6 types.
Then I run:
x<- aov(matrix~grouping.factor)
summary(aov.fit.raw, test="Wilks")
This is working fine enough, but I'm getting different
2004 Jul 08
1
Help with dual internet connection
I have 2 connections to the internet.
1 is an ADSL the other is a 3MB link over satellite.
This is a portion of my firewall script
ip route flush table 3 2> /dev/null
ip rule delete table 3 2> /dev/null
ip route add table 3 127.0.0.0/8 dev lo scope link
ip route add table 3 89.0.0.0/8 dev eth0 scope link
ip rule add fwmark 3 table 3
ip route add table 3 default via $isp2_ip dev eth3
ip
2008 Aug 05
3
Time series, least squares line
Hello,
I have a time-series of standards measured for Refractive index. They are
daily standards, however, I didn't run one everyday so some days have no
data. I can plot the values, but the x-axis does not represent the correct
time series (i.e. it's just an evenly spaced 1,2,3 type axis). I want to
plot the points with some form of representitive date line on the x-axis. I
don't
2008 Sep 21
2
Variable Selection for data reduction and discriminant anlaysis
Hello all,
I'm dealing with geochemical analyses of some rocks.
If I use the full composition (31 elements or variables), I can get
reasonable separation of my 6 sources. Then when I go onto do LDA with the
6 groups, I get excellent separation.
I feel like I should be reducing the variables to thos that are providing
the most discrimination between the groups as this is important
2006 Jan 31
4
Rails bug? Conditions on associations ignored by eager loading
I''m looking for someone to confirm the following as a bug in Rails
1.0 before I post it to Trac.
If I use eager loading on an association that has conditions defined,
the conditions are ignored.
The following example illustrates the problem. I have two tables:
create_table "blogs", :force => true do |t|
t.column "name", :string
end
create_table
2003 Jun 04
3
Limiting Users
When using windows NT and Netware there are ways of limiting the logins of
users such as only allowing them on between 9am - 5pm and limiting maximum
concurrent connection to one. Is there a way of enforcing these
restrictions through samba or similar?
Many thanks
Gareth Norman
2002 Dec 30
2
Maildir format
Started using dovecot and I am very impressed by its speed. I am
confused by what it is expecting the format of the Maildir directory
to be in. I currently have ~/Maildir which contains new, cur, and tmp
all containing email that should be in my inbox and it pops up
correctly as such when I connect to dovecot using Mutt. After the
connection a new .INBOX is created under ~/Maildir with sym
2007 Nov 05
1
Combining Density plots
Hello,
What I am trying to do is:
Generate a density plot of a population of data. This data has a bimodal
distribution so I've isolated a couple of possible sub-populations and I
want to overlay these two density plots over the first to see whether they
are contributing to the bimodal population.
I can do this fine with plot(density(...)) and lines(density(...)) . But
the resulting plots
2008 Aug 10
1
using IF command
Hey team,
If I have a matrix:
1, 2,
3, 4,
4, 0,
1, 3,
0, 3
2 columns.
I want to write an if command that looks at (in this case) row 3 and looks
to see if either [3,1] or [3,2] has a zero in it. IF it does have a zero I
want the zero to be placed in another matrix in the same position. I know
how to do the latter part, I just can't get the if command to look at both
cells and deal with
2009 Jan 30
1
plotting lines with missing data for x values
I have some data (REE plots - geochemistry) where I have values 1:14 for the
x axis, but have no data for some x values. Here for example, let's say
that I don't have data for x=2,5,8.
So
x<-1:14
y<-c(4, NA, 5, 9, NA, 3.4, 8, NA, 19, 22, 12, 14, 15.3, 15)
if I plot the data
plot(x,y)
and then I want to join with lines
lines(x,y)
How do I get it so the points join across the
2008 Aug 10
1
Scripting - query
I have a vector:
alleles.present<-c("D3", "D16", ... )
The alleles present changes given the case I'm dealing with - i.e. either
all of the alleles I use for my calculations are present, or some of them.
Depending on what alleles are present, I need to make matrices and do
calculations on those alleles present and completely disregard any formula
or other use of the