Displaying 20 results from an estimated 10000 matches similar to: "eager loading all associations"
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 Mar 31
2
Eager loading of polymorphic associations
Polymorphic associations work great until I try to do some eager
loading through :include. In my example, the interface name is
":imagehaver". Here''s my little eagerly loading find line:
Image.find(params[:id], :include => :imagehaver)
All it gives me is an ActiveRecord::EagerLoadPolymorphicError with no
further explanation. I haven''t been able to dig up anything
2008 Jan 04
1
eager loading and polymorphic associations
There is a dedicated section about eager loading in the docs. A
coworker discovered eager loading does not work in polymorphic
associations the hard way :-) so I''ve written a patch that documents it:
http://dev.rubyonrails.org/ticket/10610
There are at least a couple of tickets that implement something that
would change that though:
http://dev.rubyonrails.org/ticket/9640
2008 Apr 23
2
Bug in eager loading and polymorphic associations?
Hi friends, i''m usgin the edge version because i need eager loading on
polymorphic associations support, but i see this:
Message.find(:first, :include => :owner) #This generate this query:
SQL (0.000072) SET SQL_AUTO_IS_NULL=0
Message Load (0.000389) SELECT * FROM `messages`
User Load (0.001070) SELECT * FROM `users` WHERE (users.id IN
(1,2))
And this Message.find(:first,
2006 Jul 03
0
Eager loading of ''is meant to be nil'' Associations
If I ''find'' using :include, and some included associations are null,
then looping through the array executing ''if obj[i].assoc'' accesses the
database for a second time (as obj.assoc is nil).
eg
Topic, has_many posts
Post has_one email
and
posts = Post.find(:all, :condition => ''posts.topic_id = 10'', :include =>
2008 Apr 21
2
Eager Loading Polymorphic Associations
Hi,
I''m searching for a method of eager loading polymorphic associations under
activerecord 2.0.2. After some initial google-fu I came up with a link to
an enhancement that''s been added to edge:
http://dev.rubyonrails.org/ticket/8119
Anyone have any idea how long that might take to work its way into a general
release? I''m early in development now so I can afford to
2005 Jul 26
6
eager associations and limit/offset
Hi,
currently the eager association loading via ":include" does not work
when a has-many or habtm association is combined with offset/limit
(which is required for paginations). This is because in these cases, the
result set will contain more than one row per object, but limit/offset
works on row numbers.
I''ve developed a patch that makes this work by using 2 SQL statements
2005 May 01
0
Eager loading with self associations
Hi,
I''m new to ruby on rails and I''m trying to make a self association (as
when an employee has a manager, whom is also an employee) work with
eager loading on postgres, but the generated sql is wrong
the two ends of the association are in the same table (setores), the
foreign key is setor_pai and the generated SQL contains this:
FROM setores LEFT OUTER JOIN setores ON
2005 Jun 13
1
Question on Eager Associations
Hi - I am trying to use eager associations to cut down on database queries.
I have a feeds table, an items table, a categories table, and a
categories_items table.
feeds have items, and items have many categories (and categories can
be assigned to many items), thus the categories_items table which is a
many-many join table.
I do
@feed = Feed.find(1)
which works fine, but now I want to use
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
2006 Mar 26
0
Eager loading and polymorphic association
Hi all,
Is it possible to do "eager loading" with polymorphic associations ?
Ex : I have a Page model that acts as taggable. When I do
Page.find(:all), I would like to retrieve all tags associated with a
page.
Thanks,
Thomas.
--
Posted via http://www.ruby-forum.com/.
2005 Aug 04
1
Pagination and :include (eager associations)
I have tried to use eager association with pagination, but
the :include option is not supported:
Here''s the one-line pagination call without :include
@link_pages, @links = paginate :link, :per_page => 10, :order_by
=> sort_clause
and here the work around, using the "classic" method
# @link_pages = Paginator.new self, Link.count, 10,
2008 Sep 03
5
Eager load associations in Oracle problem with more than 1000 records
I think Rails 2.1 introduced a bug when eager loading of associations
with Oracle. In 2.1 ActiveRecord loads the included table with a big
''IN'' query: ''where association.id in (1, 2, 3, 4...)''. The problem
is that Oracle has a hard limit of 1000 values in an IN clause. I get
this error:
''OCIError: ORA-01795: maximum number of expressions in a list
2006 Jul 25
7
Question about Associations and Eager Loading
Hey everyone,
I''m currently making an application that allows users to create custom
fields that have attributes associated with each field.
They can then attach instances of these fields (each with their own
separate attribute instances) to their account.
So, it looks like this:
Fields
/ \
Field Instances Field Attributes
\ /
Field
2006 Feb 14
0
Help with Eager Association
I''ve gotten eager associations to work before, but for some reason
this isn''t working out for me this time. I''ve been scratching my head
but can''t quite figure out the nuances of what works and what doesn''t
work.
I''ve got 3 models: profile, widget_configuration and widgets
profile.rb --
has_many :widget_configurations
2006 Aug 16
1
using :select with :include to limit eager loading
Activerecord''s find option `:select'' does not appear to work when
:include is used to eager load associations. However, I sometimes want
to perform ready-made joins on associations to limit the results of a
query. here''s a simple example:
table university:
STRING code
INT id
table term:
STRING name
INT university_id
INT id
the associations of the models
2005 Oct 19
4
ER strikes back
Hi Railers,
A long, long, time ago, i made a Framework/CMS in php.
There were two core models: Content and Content_type.
Content_type was only a list of content types (as expected): new, article, etc.
Content_type was not mandatory, but it allowed later to "deactivate"
types of contents, for example.
So then Content stored the common attributes/properties between the
different content
2006 Jun 28
4
Load IDs For Limited Eager Loading
Hi
Trying to cut down on queries with eager loading and noticed the
following in development.log
Load IDs For Limited Eager Loading - SELECT id ....etc
Followed by
Load Including Associations - SELECT table.id ... etc
Is this common practice? What is limted eager loading?
Cheers
Mark
--
Posted via http://www.ruby-forum.com/.
2008 Nov 12
5
dynamic condition for has_one and eager loading issue
Hi,
I ve defined the following relation in one of my models with a dynamic
where condition:
has_one :selection,
:foreign_key => ''object_id'',
:conditions => ''selection_type = 1 and account_id = #
{self.send(:account_id)}''
That works perfect, however when I try to eager load that relation I
am getting the following error when doing a
2010 Aug 05
3
how to ? Rails 3 ActiveRecord eager loading and AREL
Hello everyone,
I would like to eager load scoped records to avoid queries executed in a
loop (huge performance impact).
The "scoped" part is what is giving me a hard time.
I''m using Rails3 RC.
Does anyone have any idea how I can do it?
Here is a test case : we have an "Article" and a "Comment" Activerecord
models,
article has many comments
comment