Displaying 20 results from an estimated 20000 matches similar to: "Single table inheritance problem"
2012 Jun 09
0
Re: ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass: 'Transactions::DummyDdnlTransaction'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. P
FIXED: Transaction is a reserved word, and it cannot be used even
though I put it into its own module. So my guess is
Transactions::Transaction still somehow got resolved to the Rails
internal Transaction class.
Renamed the Transaction (and its subclasses) to Transact and it works fine now.
Thanks!
-- cmdjohnson
On Sat, Jun 9, 2012 at 3:08 AM, Commander Johnson
2006 Sep 27
1
acts_as_taggable with single-table inheritance?
Does anyone have any experience making this work? I installed the
plugin and tried the following:
class SomeClass < ActiveRecord::Base
acts_as_Taggable
end
class SubClass1 < SomeClass
end
class SubClass2 < SomeClass
end
SubClass1.tag_with("tag")
and notice that taggable_type = SomeClass
when I do SubClass2.find_tagged_with("tag") a SubClass1 object is
2006 Apr 18
0
Recursive Tables + a single table inheritance Q
Hi, what is the RoR way of handling a recursive table? I''m a little
confused how to set this up in the model.
My example is the employee table. Employees holds a list of employees,
and a recursive link to itself to show org structure.
Employees
--------
id (pk)
name
type -- this is for single table inheritance... ie supervisor, manager,
minion
employee_id -- (fk''s to
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 05
1
Single Table Inheritance and :conditions
Single Table Inheritance question.
class Employee is the master model (table is employees)
class Cog is the subclass model, and uses single table inheritance to
be a subclass of Employee
class Blurfl is a normal model (table is blurfls)
in cog.rb, I have something like:
def foo
Cog.find(:all, :include=>''blurfl'', :condition=> ["cogs.status =
2012 Jun 09
3
ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass: 'Transactions::DummyDdnlTransaction'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Pleas
Hello,
I stumble upon this error when loading a subclass of the Transaction
class. For full details, see the pastie:
http://pastie.org/4053678
Error message: ActiveRecord::SubclassNotFound: The single-table
inheritance mechanism failed to locate the subclass:
''Transactions::DummyDdnlTransaction''. This error is raised because the
column ''type'' is reserved for
2006 Jun 06
1
Please Help with single table inheritance relationships
I''ve been searching the web, wikis, and more, and I haven''t turned up
examples of how to have multiple entities in a single-table inheritance
related to anything.
I have an addresses table, but multiple entities can have Addresses:
both Person (which has 2 addresses) and Retailer. I''ve been told that I
need to use single-table inheritance, and this was my attempt:
2005 Sep 29
0
Table relationships with single table inheritance
Hi,
How do I relate a table to another when one of the models uses single table
inheritance? Will this even work? This is the specific problem I am having:
There''s an "Address" model with "ShippingAddress" and "BillingAddress" as
subclasses. It looks like this:
class Address < ActiveRecord::Base
End
class ShippingAddress < Address
has_one :order
2006 Jan 15
2
single table inheritance: change object ''type'' after create?
Hey folks,
I''m trying to keep track of couple of different kinds of "entities" in
my rails app: "people", "organizations", and "committees". I have a
single Entities table in the database, and I''m using Single Table
Inheritance to keep the different subclasses in the same table, with a
field "type".
My problem comes when
2012 Nov 08
1
wrap_parameters and Single Table Inheritance
I''m using wrap_parameters and ActiveRecord''s single table inheritance
pattern.
I have a base class "Entity", and two types derived from it: "Person" and
"Group".
What I''d like to do is PUT a Person or Group object to
EntityController#update.
Unfortunately, this causes wrap_parameters to wrap for type "Entity"
instead of
2005 Apr 20
4
acts_as_list and single table inheritance
in a single table inheritance model, rails will automatically set the
scope for acts_as_list to the ''type'' field as well as any other scope
conditions we provide.
Is there a way to disable this? i want to use STI but I want
acts_as_list to disregard the class type when getting/setting
positions.
thanks
alan
2006 Nov 04
0
newbie: Single Table Inheritance
Hello,
I have been experimenting with Single Table Inheritance as described in the More Active Record chapter in Agile Development with Rails.
I have started with an object model with three classes x, y and z (for brevity), where y < x and z < y. (I will want to extend this model further to subclass y with other classes.)
I have created a table called x (plural) in the database with
2006 Aug 03
0
Single Table Inheritance and controllers
I''m using Single Table Inheritance in my rails application, and I was
wondering if it''s possible to create controllers and views for the STI
classes. I''ve currently tried this with a simple Item and an ActionItem
class, but Rails complains that it can''t route to the controller for
ActionItem. Is there something special I need to do to set this up? Will
every
2006 Aug 17
0
single-table inheritance and select
I''m getting some weirdness trying to use a select widget to choose
the type from a collection of three objects sharing a database table
via single-table inheritance (STI). I''d be grateful for any advice on
whether it''s a bug or a feature, if a feature why and how I can more
easily do what I''m trying to do.
So I have the usual STI setup, with a
2006 Jul 31
0
acts_as_list with single table inheritance
I have a question about where to decorate my classes with acts_as_list.
I am using single table inheritance and i have a base class LookupItem.
There are 5 child classes: Priority, Probability, RiskRating, Status, and
RiskManagementItem.
Each of these 5 items needs to act as a list. Should I use acts_as_list on
each child class or should it go on the parent LookupItem class? I''m
2006 Feb 28
0
Confusion with counter and single table inheritance
I''m having trouble getting the magical counter to work in a rails app
with single table inheritance.
following is the relevant code.
thank you
class declarations
class Job < ActiveRecord::Base
has_many :vents
end
class Vent < ActiveRecord::Base
belongs_to :job, :counter_cache => true
validates_numericality_of :width
end
class Rectangular < Vent
2006 Jan 10
0
Validation and Single-Table Inheritance
I''m seeing an inconsistent application of validation in a single-table
inheritance situation, and wanted to see if anyone else has seen this.
I have the following:
class Contact < ActiveRecord
validates_presence_of :first_name
...
end
class EmployeeContact < Contact
...
end
If I do the following while running the server or in test mode, no
error occurs eventhough the first
2009 Mar 19
0
Single-table inheritance and validation problem
Hi!
I''ve got a subscription form in which someone can decide to give a
gift to someone else. So you have to enter subscriber and recipient
data in one form.
For my user model I use single-table inheritance. It works fine but
I''ve got a bug in the validation which I''m not able to solve.
For both users, subscriber and recipient, you have to enter an email
address. It is
2007 Sep 24
0
Finds and Single Table Inheritance
Can someone please help me understand the results that are being
produced when doing queries on a table that is using single
inheritance.
Table1 < ActiveRecord::Base
Role1 < Table1
Role2 < Table1
Role3 < Table1
1. Role1.find(:all) produces:
"SELECT * FROM table1 WHERE type = ''Role1''"
2. any other find on table1 that calls anything but the Role1 Class
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 =>