Displaying 20 results from an estimated 20000 matches similar to: "eager locking"
2010 Oct 25
1
A few fixes to eager loading issues
Hey all,
I''d really appreciate some eyes on https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/5845-activerecord-3-eager-loading-fail#ticket-5845-19. There''s a small issue in Rails 3 eager loading, and this ticket has an accompanying patch.
Sssociations that show up twice in a Relation chain like:
Article.includes(:comments).includes(:comments =>
2006 Jan 19
0
Limited eager loads and conditions on the eager tables
Hi,
Why are limited eager loads and conditions on the eager tables incompatible?
Doing a find(:all) without :include causes a select * query to be generated,
which means the id fields everwrite each other if associated tables are
included using :joins.
But using :include, if conditions are placed on the tables listed in :joins
then Rails throws an exception when :limit is included too.
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/.
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
2010 Feb 14
2
has_many :through eager loading only loading one record
Hello,
I''ve been using Rails for years, including has_many :through and eager
loading, but this one has me stumped.
The problem is that Active Record is only eager-loading the first of
many records. Here are the models (note set_table_name for a legacy
schema):
class Tag < ActiveRecord::Base
set_table_name ''tag''
end
class DishTag < Tag
has_many
2007 Nov 08
0
Dynamic relation with eager loading
A model has 2 columns in its table
asset_type_id
asset_id
the asset_type_id links directly to the table asset_types via a
belongs_to
asset_types contains a single column ''name''
method_missing in the model says when you call a method matching
/^asset.*/
call the corresponding method substituting ''asset'' for the contents of
asset_type.name
(ie. the name in
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
2006 Nov 06
2
Eager Finder SQL
Hi, I just uploaded a Rails plugin that allows you to specify custom
SQL when doing a find with associations (AKA eager loading).
One of the problems I encountered when implementing the Chacha
Underground (http://underground.chacha.com) was being able to use
queries provided by the DBA to efficiently get all the informaion I
needed to render a page. In some cases, I needed to go two or three
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'',
2010 Aug 26
0
Eager loading a has_many :through (Rails3)
Hello all,
I''ve been trying out Rails 3 and can''t get past this issue:
I have a simple has_many :through:
class Author < ActiveRecord::Base
has_many :author_series
has_many :series, :through => :author_series
end
class Series < ActiveRecord::Base
has_many :author_series
has_many :authors, :through => :author_series
end
In my controller I would like to
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
2007 Jan 02
0
to_xml eager loading?
Activerecord supports eager loading with the following syntax:
Author.find(:all, :include=>[{:posts=>:comments}, :categorizations].
to_xml has an :include option that supports a shallow form of eager
loading to create the xml: author.to_xml(:include[:posts]).
Is there a way to generate the xml from all associated objects for a
particular model instance?
2014 Apr 02
0
Trying to understand eager loading and accessing collections from within instance methods
I'm trying to optimize some of my queries by taking advantage of eager
loading.
I've created a gist with the specific problem I'm seeing
here: https://gist.github.com/tybenz/9944205
Any ideas why the eager loading works for grabbing the collection from the
rails console but a SQL query is required when I try to access the
collection from inside the instance method?
Is there
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
2006 Oct 08
1
Two-way eager loading?
My problem is that I have two classes where the eager loading isn''t
working as well as I would hope...
Here are my two classes:
class Daynote < ActiveRecord::Base
belongs_to :userplace
class Userplace < ActiveRecord::Base
has_many :daynote, :dependent => true
When I show my userplaces, I want to get the associated daynotes with
them, so I am doing:
@userplace =
2008 Jun 25
1
"Complex" Eager Loads
Hey gang.
Is it possible to extend the eager load SQL at all? What I''m hoping
to do is eagerly load an associate that, in turn, joins in some data
from another table.
Many thanks,
James
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email
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
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
2011 Sep 29
0
New Blog Series: TheStraightTech
One of the positive outcomes of the community contest (http://gluster.org/contest/ ->ends tomorrow!) is a series of helpful HOWTO articles designed for those looking to tune GlusterFS for better performance, or for those looking to get up to speed faster on how to use.
These articles and posts originated on http://community.gluster.org/ -
To see the entire list of articles -
2008 May 08
1
Eager loading of association extensions
Hello all,
Is it possible to do eager loading of association extensions?
That is, the following code produces one SQL query:
cat = ProductCategory.find(:first, :include => :pricing_rules)
cat.pricing_rules
But if in ProductCategory I have an association extension like this:
has_many :pricing_rules do
def applicable()
find(:all).select(&:applicable?)
end
end
the