similar to: Eager loading with self associations

Displaying 20 results from an estimated 7000 matches similar to: "Eager loading with self associations"

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 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 Mar 13
4
Find and eager loading questions
Hi all, I want to see if I''m not missing something with associations and eager loading. (I''m currently using Locomotive on OS X and SQLite3.) I have two simple tables/models, set up properly: teams has_many :matches and matches belongs_to :teams. Matches has a match number and a team_id field (along with several other fields) and teams has a team_number field (again, along with
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
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 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
2006 Sep 28
5
Eager loading using find_by_sql
Here''s the problem I have the following models User - is a person Team - is a team Wherenote - snipet of info about a user''s whereabouts on a certain day Team has_and_belongs_to_many :users User has_and_belongs_to_many :teams has_many :wherenotes Wherenote belongs_to :user each Wherenote has a note_date On one page I want to pull back all the Users from a particular Team
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 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,
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
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 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
2015 Jan 04
2
A lot of messages in full_audit log
Hi, I'm using full_audit vfs module and I'm seeing a lot of duplicated messages in log file. Why does it happens ? How can I configure de smb.conf not to log duplicated information ? Duplicated log: Jan 4 13:27:50 server smbd_audit: [2015/01/04 13:27:50|semirames|samba-admin|192.168.0.3|setores]|pread|ok|Atendimento/James.txt Jan 4 13:27:50 server smbd_audit: [2015/01/04
2006 Dec 14
3
Problem with ActiveRecord and Associations
Hi, I''m having what I believe to be a typecast problem with ActiveRecord and Associations. In the code below, I need to flag a contact record for deletion if the contact doesn''t have any addresses or books records: sql = "select id, delete_flag from contacts where id = #{params[:id]}" contact = Contact.find_by_sql(sql) if (contact[0].addresses.count +
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
2007 Dec 12
2
possible bug in eager loading
Hello, @users = User.find(:all, :include => {:user_data => :user_data_field}, :order => "username = ''someone-oHC15RC7JGTNLxjTenLetw@public.gmane.org'' desc", :limit => 50) This produces: User Load IDs For Limited Eager Loading (74.648762) SELECT * FROM (SELECT DISTINCT ON (users.id) users.id, username AS alias_0 FROM users LEFT OUTER JOIN
2020 Mar 16
0
Problems with ACLs
Hi, >Is this the machine that you cannot set the permissions on ? Yes. >If so, what is the filesystem ? Ext4 for SO and Ext4 for shared files, but I have created a pool ZFS on this last filesystem (/dev/vdb1). Dispositivo Inicializar In?cio Fim Setores Tamanho Id Tipo /dev/vda1 * 2048 62912511 62910464 30G 83 Linux Disco /dev/vdb: 5 TiB, 5497568624640 bytes,
2006 Feb 10
1
Eager loading issue
I have three tables, Invoices, Projects, and Managers. Each manager has many projects. Each project has many invoices. When displaying a list of the invoices, I am using: Invoice.find(:all, :include => [:project]) Since the list shows information from the project table. (For example, a table showing Invoice Date, Project Name). However, I''d also like to show the manager name.
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
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