Displaying 20 results from an estimated 20000 matches similar to: "Bug (or feature?) in association_proxy: attributes in conditions"
2006 Mar 27
2
:through and STI
Hi,
I''m trying to use :through and STI using the trunk version of Rails, but
I get the following error see bottom of this msg[1]
here are my classes.
class Player < ActiveRecord::Base
end
class Ladder < ActiveRecord::Base
has_many :subscriptions
has_many :players, :through => :subscriptions
end
class SingleLadder < Ladder
end
class Subscription <
2007 Aug 15
2
has_many :through ... What am I missing?
class Ladder < ActiveRecord::Base
has_many :players
has_many :users, :through => :players
end
class Player < ActiveRecord::Base
belongs_to :users
belongs_to :ladders
end
class User < ActiveRecord::Base
has_many :players
has_many :ladders, :through => :players
end
When I try the following code (on the console) I get an error:
@ladder = Ladder.find(1)
@ladder.users
I
2006 Apr 06
4
Record retrieval in Many-to-many using :through not working
Hello,
I get an error while retrieving records from the following model structure.
Tables
foods - id, food
foodallergies - food_id, symptom_id, a few other columns
symptoms - id, symptom
Models
class Food < ActiveRecord::Base
has_many :foodallergies
has_many :symptoms, :through => :foodallergies
end
class Symptom < ActiveRecord::Base
has_many :foodallergies
has_many :foods,
2007 Jan 10
3
ActiveRecord Error?
We spent a big chunk of yesterday hunting down a strange bug in one of
our rails apps and created a test project to try out different theories
on what was going on. The result so far is a very small test case app
that perfectly reproduces the problem. The question is, is there
anything *wrong* with what we''re doing here, or is it a problem with
ActiveRecord? We''re on rails
2006 Apr 16
8
"Cannot convert String to Integer" after using association
So, I''ve written a partial that does some stuff with a given instance of
my class "entity". Entity is ActiveRecord. I''m able to retrieve all
sorts of data from an @entity, until I do something like:
<% for @attribute in @entity.attributes %>
<div id="attribute_<%= @attribute.id %>">
<%= render(:partial =>
2009 Nov 17
5
has_many :through and foo.bars.include?
hallo everybody,
i already googled the following problem, but there are so many
questions regarding "has_many :through", that i just couldn''t find
what i was looking for. so, i''m really sorry if this has been asked
before. if so, just drop me the link.
i have a has_many :through relationship similar to the following
example:
class Group < ActiveRecord::Base
2005 Dec 27
3
Trouble combining :has_many, :finder_sql and :conditions to create a sub-search
I''m sure there''s something right under my nose that I''m missing. I
have two tables with two parallel one-to-many relationships. I wish to
use the :finder_sql parameter to essentially ''or'' the two foreign
keys.
What isn''t working for me is performing a ''sub-search''.
Let''s say the tables are "stores" and
2007 Jan 12
4
FW: Get dialed numbers in AGI
On 1/11/07, Mike D'Ambrogia <miked@jamagination.com> wrote:
>
> Ralph
>
> Kind of new to asterisk, and really new to AGI but it looks like you were
> trying to have the AGI script tell asterisk to read and lay the results into
> my_var and then regain control in the AGI script, is that correct?
>
> If so I don't think that will work since the dialplan
2009 Jul 20
2
Hitting unknown error with "can't dup NilClass"
Hi,
My system has been encounter this problem, and I couldn''t find
solution after debugging. My scenario is stated below:
class user
has_many :posts
has_many :comments
end
class post
belongs_to :user
has_many :comments, :as => :commentable
end
class comment
belongs_to :post
belongs_to :user
end
For this case, I am trying to retrieve each post''s comment
2006 Jan 14
3
link_to_remote where the url contain a javascript variable
Ok, so I am basically trying to use ''link_to_remote'' and pass the value
of a javascript variable as an argument. Something like that:
link_to_remote "my_link",
:update => ''my_div'',
:url => { :action => "my_action", :var =>
''my_var'' }
Basically,
2007 Jan 10
2
Get dialed numbers in AGI
Hi,
I'm trying to write a AGI in PHP to get the numbers dialed (with read()),
save it into a variable to insert it into a SQL server database. But I
cannot see results into the variable, it always return NULL.
Here is a piece of the AGI.
fwrite(STDOUT,"exec Read my_var|/sound_to_play|5|||15 \n");
fflush(STDOUT);
$conn=odbc_connect('MSSQL', 'USER', 'PASS');
2006 Dec 20
4
undefined method `fullname' for #<User:0x357e380>, BUT works on first view?
Hi all,
Please excuse the long post, but I wanted to make sure you have all the
information....
I have a NewsModel that looks like this:
class News < ActiveRecord::Base
belongs_to :user
validates_associated :user
validates_length_of :title, :description, :minimum => 5, :allow_nil
=> false
acts_as_commentable
acts_as_taggable
def self.find_recent
News.find(:all,
2011 Oct 20
2
Access other model attributes directly with has_one, belongs_to ?
So, I have 2 models A and B that share 5 common attributes and all other
attributes are different. So I wanted to extract these 5 out into one
common table and use has_one, belongs_to to knit it back together. So
now there are 3 tables with 1 having the shared properties, we''ll call
this table C.
Table A
id
dollar_amount
Table B
id
quantity_on_hand
Table C
id
version
My question is,
2006 Jul 04
2
has_many working correctly only on reload!
I have this code that is using svn externals with rails EDGE working
fine for the past couple of months. A couple of days ago, this code
died. Even after deleting vendor/rails, this code doesnt work:
class Tag < ActiveRecord::Base
has_many :taggings
has_many :events, :through => :taggings
has_many :users, :through => :taggings
end
class User < ActiveRecord::Base
# Virtual
2005 Dec 27
0
How do I combine :finder_sql and :conditions to perform a sub-search on a custom has_many relationship?
I''m sure there''s something right under my nose that I''m missing.
I have two tables with two parallel one-to-many relationships. I wish
to use the :finder_sql parameter to essentially ''or'' the two foreign
keys.
What isn''t working for me is performing a ''sub-search''.
Let''s say the tables are "stores" and
2005 Jun 02
0
Don't use an attribute/column that matches a Kernel method (including 'y')
I''ve found a problem, and it might be bug in Ruby itself, but I''m not sure.
Say I''ve got a model object (Point) whose table contains column "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
2006 Nov 20
5
RMagick load problems?
I have a page (model: daily_progress_chart) that uses RMagick and
ImageMagick to create a chart using RVG. A few days ago (after some
updates to Rails), this chart stopped working on both my development
machine (MacBook Pro) and the production server (Gentoo Linux). I get
the following error messages. I am totally lost, but I assume that there
is a problem with RMagick. Any ideas anyone?
On
2006 May 20
1
acts_as_paranoid overrides ActiveRecord::Base??
Guys,
I am trying to figure out what exactly does this line do at the end of
"acts_as_paranoid" plugin?
ActiveRecord::Base.send :include, Caboose::Acts::Paranoid::ActiveRecord
My problem: I have some classes that I use acts_as_paranoid, and others
with tagging support. Classes declared as taggable, throw error, which
appears to be in the acts_as_paranoid version of the
2009 Feb 20
6
How to mock an object defined in the before_filter function?
Hello,
I am trying to implement the following scenario, but I am stuck ...
The thing is I want to initialize a variable @comment when the stub
function "find_comment" is called.
The way I do it below doesn''t work, since
"before_filter :find_comment" returns true/false and @comment
initialization is done inside it. Could you please give me a hint how
to do it?
One
2007 Mar 26
5
Session trouble
I am having a problem with an assignment to an object stored in session.
for example when I am in console
o = NewOrder.new
# dl = DeliveryLocation.new
# o.delivery_location = dl #=> returns a delivery location object
# o.delivery_loaction.save #=> returns true
when I am using the controller
delivery_location = DeliveryLocation.new(params[:delivery_location])