Displaying 20 results from an estimated 7000 matches similar to: "Eager loading with self associations"
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
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 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 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 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
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 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
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
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,
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 +
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,
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
2005 Jul 28
0
ActiveRecord, computed values, and associations
Is there some sort of good pattern for dealing with computed values with
Rails/ActiveRecord?
A simple example: 3 tables, classes, students, and student_class_records
(habtm style relation but contains a good deal of additional state so is
modeled explicitly)
Something like select the 10 classes with the most students. Easy enough
in SQL. So I''m using a lot of find_by_sql and
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
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 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 =>
2005 Dec 14
0
eager loading all associations
Hi Railers,
Is there a way to specify all relations in a :include option while
find()ing?
I have a model with a lot of associations, and sometimes i would like to
query for all them.
Something like Model.find(params[:id], :include => :all) would be nice.
Alternatively, i don''t know if there is a mehod to retrieve all model''s
associations, to do something like