similar to: Rails bug? Conditions on associations ignored by eager loading

Displaying 20 results from an estimated 8000 matches similar to: "Rails bug? Conditions on associations ignored by eager loading"

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'',
2006 May 21
3
Using ParseDate in for loop
Hi, I''m trying to use ParseDate within a for loop but I get this error: can''t dup NilClass Any suggestions for making this work? Thanks, -Jason
2006 Apr 16
8
"Cannot convert String to Integer" after using association
So, I''ve written a partial that does some stuff with a given instance of my class "entity". Entity is ActiveRecord. I''m able to retrieve all sorts of data from an @entity, until I do something like: <% for @attribute in @entity.attributes %> <div id="attribute_<%= @attribute.id %>"> <%= render(:partial =>
2006 Jan 12
2
Engines issue: rake test_plugins failing when it shouldn''t
I create a simple engine with a simple controller: class FredController < ApplicationController def hello render :text => ''Hello, world!'' end end and I create a simple functional test within the engine: class FredControllerTest < Test::Unit::TestCase ... def test_hello get :hello assert_response :success end
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 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
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
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,
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
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
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
2005 Oct 18
3
hand writing sql for eager loading of thumbnails
Can anyone point me to a resource for hand coding some sql so I can create my own for the following models: I''m using single table inheritance to store related objects eg: Thumbnail < Image < File :: ActiveRecord:Base Image has_many thumbnails Thumbnail has_one image When I come to list thumbnails I''d like to be able to: 1. List all images relating to a product 2.
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
2006 Feb 14
7
9cays - A Rails app for Group Email
Even though it''s a little OT, I thought I''d announce the free public beta of a new Rails app that I''ve been working on for a while: http://9cays.com Think of it as mini-mailing list software. For a lot of smallish conversations, normal mailing list are too heavyweight (requiring setup, moderation, admin, etc.), but group email is a pain because messages
2007 May 17
8
Model: self is not child's parent
Assume a model Parent and another model Child. Child belongs_to Parent and Parent has_many Children. The following fails: @ p = Parent.find(:first) assert p.equal?(p.children[0].parent) @ It seems odd to me that I and my child''s parent are not the same object. In fact, this is royally screwing me up. Can anyone tell me why this is or point me at a relevant discussion, blog posting,
2006 Jan 16
6
the competition?
The ''gmail'' video seems really interesting: http://www.morfik.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060116/385e77f0/attachment.html
2006 Jul 09
8
Can the has_many create() method return an ID?
Hi all, I have a has_many relationship, Cookbook :has_many Recipes If I want to create a new recipe in my cookbook I do: cookbook.recipes.create(data) It would be nice if I could then easily get the id of the new recipe, but the create() method doesn''t seem to return anything. Any ideas how? Thanks in advance! Cameron -- 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
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