search for: load_target

Displaying 18 results from an estimated 18 matches for "load_target".

Did you mean: p_load_target
2008 Nov 19
3
Overwriting / Decorating ActiveRecord association accessor
Hi, I am trying to overwrite the accessor of a has_many association. Basically my class looks like this: class Person has_many :emails has_one :link, :class_name => ''PersonProxy'' def emails_with_link link.emails + emails_without_link end alias_method_chain :emails, :link end Now that works fine if I only access the collection like >>
2011 Mar 29
0
Issue / code smell in AssociationProxy
...om /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/ lib/ruby/1.8/yaml/rubytypes.rb:15:in `to_yaml'' Now to the point: tracing the code path lead me to AssociationProxy#method_missing which for 2.3.x or 3.0.x is very similar: def method_missing(method, *args) if load_target unless @target.respond_to?(method) message = "undefined method `#{method.to_s}'' for \"#{@target}\":#{@target.class.to_s}" raise NoMethodError, message end if block_given? @target.send(method,...
2009 Jul 20
2
Hitting unknown error with "can't dup NilClass"
...active_record/ base.rb:616:in `find'' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ associations/belongs_to_association.rb:44:in `find_target'' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ associations/association_proxy.rb:240:in `load_target'' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ associations/association_proxy.rb:112:in `reload'' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ associations.rb:1231:in `user'' Need some help for this. Thanks in advance.
2006 Apr 06
4
Record retrieval in Many-to-many using :through not working
...klass'' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0 /lib/active_recor d/associations/has_many_through_association.rb:54:in `find_target'' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0 /lib/active_recor d/associations/association_proxy.rb:116:in `load_target'' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0 /lib/active_recor d/associations/association_proxy.rb:109:in `method_missing'' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0 /lib/active_recor d/associations/has_many_through_association.rb:47:in `me...
2012 Mar 02
0
ConnectionNotEstablished when using connection on AR::Base abstract subclass
...m /Users/mlartz/.rvm/gems/ruby-1.9.3-p0@tmp/gems/ activerecord-3.2.2/lib/active_record/associations/ collection_association.rb:380:in `find_target'' from /Users/mlartz/.rvm/gems/ruby-1.9.3-p0@tmp/gems/ activerecord-3.2.2/lib/active_record/associations/ collection_association.rb:333:in `load_target'' from /Users/mlartz/.rvm/gems/ruby-1.9.3-p0@tmp/gems/ activerecord-3.2.2/lib/active_record/associations/collection_proxy.rb: 44:in `load_target'' from /Users/mlartz/.rvm/gems/ruby-1.9.3-p0@tmp/gems/ activerecord-3.2.2/lib/active_record/associations/collection_proxy.rb: 87...
2006 Mar 13
0
Problems with association named :task
...: undefined method `find'' for Rake::Task:Class ./script/../config/../vendor/rails/activerecord/lib/active_record/associations/belongs_to_association.rb:44:in `find_target'' ./script/../config/../vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:106:in `load_target'' ./script/../config/../vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:32:in `reload'' ./script/../config/../vendor/rails/activerecord/lib/active_record/associations.rb:661:in `task'' ./script/../config/../vendor/rails/activerecord/lib/active...
2006 Jan 31
2
How can I overwrite the parent.children.push(child) Method?
Hi all I want to overwrite the push method (which is an alias of <<, the same as concat) of collections, and there I want to test if :uniq is set to true in the relationship. If so, the method should check if the passed object is already related to the parent, or not (only then it will be added). But I just can''t find the original code of this method, so I could overwrite
2005 Jun 02
0
Don't use an attribute/column that matches a Kernel method (including 'y')
...;y". Model Circle has_one Point center. When I load a Center from the database, I"m unable to get the actual value for y. Here is a summary of what I see when I debug into Circle.center.y: Stepping into y(), I find myself in association_proxy@method_missing. Makes sense. It calls load_target, and successfully loads a good-looking Point into @target. The code then call @target.send(symbol, *args, &block). When I step into this, I find myself in yaml.rb, Kernel#y. I expected to find myself in active_record/base.rb, method_missing. Now, once you understand that yaml has added a...
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
2006 May 20
1
acts_as_paranoid overrides ActiveRecord::Base??
...#39;' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/associations/has_many_through_association.rb:54:in `find_target'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/associations/association_proxy.rb:116:in `load_target'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/associations/association_proxy.rb:109:in `method_missing'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/associations/has_many_through_association.rb:47:i...
2006 Mar 27
2
:through and STI
...from ./script/../config/../config/../vendor/rails/activerecord/lib/active_record/associations/has_many_through_association.rb:54:in `find_target'' from ./script/../config/../config/../vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:116:in `load_target'' from ./script/../config/../config/../vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:109:in `method_missing'' from ./script/../config/../config/../vendor/rails/activerecord/lib/active_record/associations/has_many_through_associati...
2007 Jul 17
5
habtm confusion
...and_belongs_to_many_association.rb:55:in `find'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/associations/association_collection.rb:159:in `find_target'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/associations/association_proxy.rb:131:in `load_target'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/associations/association_proxy.rb:29:in `respond_to?'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/helpers/form_options_helper.rb:116:in `options_for_select'' /usr/lib/ruby/gems/1.8/gems/ac...
2007 Aug 15
2
has_many :through ... What am I missing?
...'' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/associations/has_many_through_association.rb:115:in `find_target'' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/associations/association_proxy.rb:131:in `load_target'' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/associations/association_proxy.rb:122:in `method_missing'' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/associations/has_many_through_association.rb:108:i...
2005 Dec 11
4
Problem with acts_as_paranoid: "ArgumentError: Unknown key(s): group"
...d-0.2/lib/acts_as_paranoid.rb:62:in `find'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/associations/has_many_association.rb:111:in `find_target'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/associations/association_proxy.rb:81:in `load_target'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/associations/association_collection.rb:20:in `<<'' ./test/unit/ticket_test.rb:62:in `test_add_message_to_existing_ticket'' The code in question: t.messages << Message.new({ :body =...
2006 Dec 22
2
Relating Namespaced Models
...' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5618/lib/active_record/associations/association_collection.rb:159:in `find_target'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5618/lib/active_record/associations/has_many_association.rb:123:in `load_target'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5618/lib/active_record/associations/association_proxy.rb:122:in `method_missing'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5618/lib/active_record/associations/has_many_association.rb:98:in...
2007 Jan 23
4
Rails bug reports & patches - why no action?
I have noticed at the dev.rubyonrails.org site that many tickets with pretty clear-cut bug reports/patches or feature enhancements don''t get any attention. They sit there for months at a time. Why is this? Are tickets from those that are not in rails-core deprioritized? Are there just not enough people that have the power to act on tickets? I know it''s not lack of test cases
2008 Nov 06
10
Rails 2.1.2 bug in include on has_many?
...tions/association_collection.rb:47:in `find'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_collection.rb:308:in `find_target'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_collection.rb:262:in `load_target'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_proxy.rb:169:in `method_missing'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_collection.rb:279:in `method_missing'' app/controllers/test...
2010 Oct 11
8
Nooby Stuck - "has_and_belongs_to_many" relationship
trying to set up a "has_and_belongs_to_many" relationship would very much appreciate the help, not sure what im doing wrong at all. Scheme.rb class Scheme < ActiveRecord::Base validates :schemename, :presence => true belongs_to :user has_many :levels, :dependent => :destroy has_and_belongs_to_many :works end Work.rb class Work < ActiveRecord::Base