Displaying 3 results from an estimated 3 matches for "interpolate_sql".
2008 Nov 12
5
dynamic condition for has_one and eager loading issue
...that up and running?
Thanks a lot in advance
NoMethodError (undefined method `account_id'' for
#<ActiveRecord::Associations::ClassMethods::JoinDependency::JoinAssociation:
0x4d5bf5c>):
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/associations.rb:1621:in `interpolate_sql''
(eval):1:in `interpolate_sql''
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/associations.rb:1600:in `association_join''
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/associations.rb:1599:in `each''
C:...
2006 Jun 30
0
Interpolation in association conditions broken; broken backwards-compatibility?
...ble to interpolate values into
associations'' conditions with single quotes, but it isn''t anymore.
has_many :widgets, :conditions => ''brand_id = #{brand_id}''
Anyone else remember that? It seems to have been snuffed out in
changeset 3897 with the removal of interpolate_sql(@conditions)
Was the change (and the fact that it breaks backwards-compatibility)
known and announced or is it just an oversight? Once in awhile
there''s just no other way to do what this allows (short
of :finder_sql, which limits you significantly).
Thanks,
Jason Garber,
Web Prog...
2005 Oct 26
0
Expression Interpolation and ActiveRecord relationships
...that''s been good for simple cases.
What I''ve found is that things like #{self.id} work fine, but more
complex references, such as #{self.related.name} (where related is a
belongs_to relationship in the model) won''t work.
The stack trace infers that the problem is with interpolate_sql in
active_record/base.rb (line 1314).
I guess I''m trying to do too much here, and I''m not sure what to try
instead. Any suggestions?
BTW, the actual query I''m running is rather large, and needs a number of
joins, so I''m not sure that using find() would do it...