Displaying 20 results from an estimated 20000 matches similar to: "How do I check if something was eagerly loaded?"
2008 Sep 16
3
has_one :through eager-loading problem
I have a problem with the :include option in find for my
has_one :through association.
I have Users, Profiles and Customers, all connected to each other with
a has_one :through => :membership association like this:
class Profile < ActiveRecord::Base #could also be user or customer
has_one :membership # i saw an acrticle of Ryan about
has_one :through, there this would be has_many, is
2006 Aug 07
1
Eager loading wierdness
Consider this problem.
I have an Item that has_many Features
I want to find all Items with a Feature name of ''foo''.
Normally you would do this..
@items = Item.find(:all, :conditions=>["features.name = ?", ''foo''],
:include=>:features)
This all works fine and dandy except for this problem.
If you do this...
<% for item in @items %>
2010 May 07
1
Can't eagerly load a polymorphic association defined in an STI parent class?
If I define an association (in my case a polymorphic one) in an STI
parent class, and try to eagerly load it in a subclass, I get the
following error:
ActiveRecord::ConfigurationError: Association name ''myassoc'' was not
found; perhaps you misspelled it?
If I redefine the same association again in the STI subclass, it
works.
Is this a bug or what?
--
You received this message
2006 Feb 24
3
Migrations, data loads and changes to the model
Guys,
I''ve run across an interesting scenario with my migrations, and I hope
you might share some insight.
Let''s say I have 3 migrations and two Models (Person and Car):
001_initial_schema.rb
002_data_load.rb
003_add_car_association.rb
The first creates the initial schema...the second loads default data
using model objects of Person to do so, and the third creates a new
2006 Jan 05
0
Keep the Queries Down or "Referencing eagerly loaded models"
Before I start, I''ve read the ActiveRecord docs on eager loading, but
for the life of me, I can''t seem to get it working.
What I mean by this, is that the eager query looks good (I can paste the
sql dump, but it looks good to me - and runs well independantly), but it
seems that I''m referencing the eagerly loaded data in a way that
activerecord doesn''t
2006 Apr 03
2
Problems with STI in has_many/belongs_to in Rails 1.1
I have a problem that surfaced in my attempt to upgrade my application
to Rails 1.1.
We have a STI model on the "belongs_to" side of a has_many/belongs_to
relationship. All my unit tests for this model pass, and the
relationships all seem to work fine.
But in my functional tests, I''m getting errors. I''ve traced it back
into the call to the has_many
2008 May 05
1
eager loading has_one fix
I believe I have fixed the issue Trever noted with has_one (http://rails.lighthouseapp.com/projects/8994/tickets/64-eager-loading-inconsistency
) if people would like o have a look.
Fred
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2005 Apr 27
5
Eager load mysteriously deletes records
Hi
This looks like a bug in ActiveRecord.
I am messing with eager loading (on 12.1) and all of a sudden records
started disappearing from a table (and I am not doing anything delete
related)!!
The following line works OK:-
@todos = Todo.find(:all, :include => [ :whens],:order => "position ASC")
The following line is mysteriously deleteing :where rows from the DB
after
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
2006 Jan 06
2
How do I reference eagerly loaded Models in the View?
[I hope the repost isnt'' "minded". Following the advice of another
thread I''ve changed the subject to a question. If I haven''t included
important info, please ask. My database is being unduly killed. Jodi]
Cheers on-the-Rails-ers,
Before I start, I''ve read the ActiveRecord docs on eager loading, but
for the life of me, I can''t seem to get
2006 Jan 05
0
Re: help with link_to_if, I can''t make it work..
Nooby guess,
Do you need a comma between comment.web_site and {"class... ?
Looks like there should be 4 params...test, text, href and html_params
A.
On 4 Jan 2006, at 04:42, rails-request@lists.rubyonrails.org wrote:
> Date: Wed, 4 Jan 2006 05:05:39 +0100
> From: charlie bowman <cbowmanschool@yahoo.com>
> Subject: [Rails] Re: help with link_to_if, I can''t make it
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 =>
2006 Feb 21
4
Multi-page forms
I''m curious to see how others are dealing with the construction of
multi-page forms. I can see a couple of ways to do this, each with
their own advantages/disadvantates.
Approach 1:
* define one table with columns for each form entry.
* define a method/view for each page, which only displays a subset of
the fields.
* submitting a page saves the data and moves on to the next page.
2006 Mar 21
3
Switch...err Capistrano hangs
I''m having a little bit of difficulty deploying my app. I''ve run the
setup and it works with Cap, but when I try to deploy it hangs at
"querying latest revision". I can access my svn locally (I''m on a
windows xp sp2 machine) using SubClipse plugin, but not through the
command line though (yes, svn client is installed).
I''m pretty sure that
2008 Feb 19
0
Issue with Observers and has_one association...
Hey Guys,
I''m getting a peculiar bug working with Observers and has_one
associations. When a has_one association is invoked by an Observer it
always returns null. I looked in the development.log file and the SQL
for the has_one association isn''t even being executed. On the other
hand, when I replace the has_one association with just a hand crafted
method, it does get called
2005 Jul 14
1
Single-table inheritance and eager loading
I have a people table with four types of people: clients, spouses,
children, and others all setup using single-table inheritance with a
foreign key back to a household record.
A Household has_one client and spouse, and has_many children and
others. I want to use a single "Household.find(@session
[:household_id], :include => [:client, :spouse, :children, :others])"
2007 Sep 25
2
Patch Review for selective joining of eager-loaded tables in pre-query
For those of you following the earlier saga of the performance of limited
eager loading, I''ve decided to give up on pursuing my original patch. I
received some support on the simplification argument (see my blog if you
don''t know what I''m talking about), but it doesn''t seem like it''s worth
breaking existing behavior.
So I''m moving onto
2008 Apr 07
2
Simple active record issue. I must be missing something.
Here''s a seemingly simple ActiveRecord use case. I have Projects and
Users. Each project has a single team leader as well as a review team
that consists of several users. I would like to use the same User
model for authentication and just reference these users in my Project
model.
I tried this but got an "unknown column" error (for User.project_id)
class Project
has_one
2009 Oct 08
6
Eager Loading a Relationship That Has No PK/FK
I''m attempting to wrestle an old DB into Rails.
This relationship is giving me trouble:
class Show < AR::Base
has_many :segments
end
class Segment < AR::Base
belongs_to :show
has_one :media #this has no PK/FK relation
end
A Segment is "linked" to Media by Media.name, which is the result of
concatenating Segment.name and Segment.part. As I said there are is no
2008 Sep 29
1
has_one :through with :source. How to alias association?
Hi to everyone,
I have the following models:
class Attachment < ActiveRecord::Base
has_attachment :content_type => [:image, ''application/pdf''],
:max_size => 3.megabytes,
:path_prefix => ''../private/attachments'',
:storage => :file_system,
:processor => :rmagick,