Displaying 20 results from an estimated 600 matches similar to: "Problems with association named :task"
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 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
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,
2005 Dec 11
4
Problem with acts_as_paranoid: "ArgumentError: Unknown key(s): group"
Here''s the full error:
1) Error:
test_add_message_to_existing_ticket(TicketTest):
ArgumentError: Unknown key(s): group
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.4/lib/active_support/core_ext/hash/keys.rb:48:in
`assert_valid_keys''
/usr/lib/ruby/gems/1.8/gems/acts_as_paranoid-0.2/lib/acts_as_paranoid.rb:125:in
`validate_find_options''
2007 Jul 17
5
habtm confusion
Hello friends!
I am trying to make a database that will have a group of people set to
committees, and a person can be in multiple committees, and a committee
obviously has multiple people. The people are senators at my
university. These are my current models:
senator.rb:
--
class Senator < ActiveRecord::Base
validates_presence_of :first_name, :last_name, :floor
has_and_belongs_to_many
2006 Dec 22
2
Relating Namespaced Models
I am dealing with a large project. I use a lot of STI and therfore have
a lot of models. I''d like to use namespaces to help organize my models
but am having trouble getting started.
I have a base model Term::Base located in /app/models/term/base.rb:
class Term::Base < ActiveRecord::Base
set_table_name "terms"
end
I have a non-namespaced client model:
class Client <
2005 Oct 27
0
has_one with Single Table Inheritance - NameError : uninitialized constant
I am having a problem with using SIngle Table Inheritance with a has_one
relationship, and I am at a loss of what could be causing it. Below is the
related code and the error message.
class User < ActiveRecord::Base
has_one :wishlist
end
class List < ActiveRecord::Base
belongs_to :user
end
class Wishlist < List
has_and_belongs_to_many :items, :class_name =>
2012 Mar 02
0
ConnectionNotEstablished when using connection on AR::Base abstract subclass
I''m using AR outside of Rails and calling establish_connection on an
ActiveRecord::Base abstract_class subclass (to protect my connection
in case anyone else is using AR). It was working just fine with AR
3.0.9, but I recently attempted to upgrade to AR 3.2.2. Now, when I
hit a "nested" query from a has_many, I get a
ActiveRecord::ConnectionNotEstablished. If I call
2006 Jul 28
3
Forms: handle foreign keys (AssociationTypeMismatch)
Hi all
I tried and tried and tried, but I still fail in creating a form with
proper validation and stuff for foreign keys... So I''d really like to
get some help here.
I''m creating a booking site for DJ''s, and for every booking one can
choose one of different countries:
class Booking < ActiveRecord::Base
validates_presence_of :country_id
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
2008 Nov 06
10
Rails 2.1.2 bug in include on has_many?
In my continued efforts to port my rails 1.x app to Rails 2.1.2, I keep
running into what appear to be ActiveRecord bugs.
I am using an :include on a :has_many definition:
class Request < ActiveRecord::Base
has_many :service_types, :order=>''service_types.id ASC'',
:include=>:service_response
[...]
There''s no reason this wouldn''t be supported in
2009 Feb 02
4
AssociationTypeMismatch got Fixnum
I''m using rails 2.0.5 and mongrel.
I have a Page and a Source models.
class Source < ActiveRecord::Base
has_many :pages
end
class Page < ActiveRecord::Base
belongs_to :source
end
Basically I''m listing pages with their sources; In production and
development ( I use mongrel_cluster in the first and a single mongrel
on the second) I got this error:
2007 Feb 08
5
a possible bug in Has_many :through using :soucre
I''ve been stumped on this for a few days and I''m not sure if it''s an error
on my end or an actual bug.
I have a system where I have workshops and users. Workshops have students,
presenters, and troubleshooters. I wanted to represent this simply by
using has_many :through with :source.
Workshop
has_many :presenters, :through =>:presenterships, :source=>:user
2006 Jul 24
2
Thread.new with ActiveRecord under Mongrel vs. FastCGI
Hi All,
I''m going to end up hosting a site on a server in a fastcgi environment,
but I''ve been doing most of my development under mongrel. I have a bit
of code that spawns a thread, and in the thread it makes some remote
calls (openuri) and does some database inserts via activerecord.
When I do this under FastCGI, everything appears to work as expected.
When I do it under
2007 Mar 31
0
routing problem with controllers in other dirs
Hi all
I have a problem with mapping url to controller which is deeper in
controller directory (not root directory). I wanted to move
acts_as_authenticated account_controller deeper to directory (let''s
call it Foo) and route it as /Foo/Account, but i always seem to get
exception that no route matched my request
file structure:
/app
+- /controllers
+- /Foo
+-
2011 Mar 29
0
Issue / code smell in AssociationProxy
I came across an issue in my code and after a hard debug session I
found something that smells.
First the context of my issue. I have a AR object that has a
polymorphic belongs_to currently tied to nothing, I want to dump it to
YAML.
record.to_yaml
This raises the following exception:
TypeError: wrong argument type nil (expected Data)
from
2006 Mar 24
1
Bug (or feature?) in association_proxy: attributes in conditions
Hi List,
When I do something like
belongs_to :thing, :conditions => ''var = #{my_var}''
method_missing in association_proxy.rb gets recursively called.
Are these bind-style vars not allowed? Given the code in the
conditions method of association_proxy.rb, it looks lilke they''re
meant to be.
I''m running -v 4021 of rails.
Cheers,
Ian
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