Displaying 20 results from an estimated 20000 matches similar to: "newbie: Single Table Inheritance"
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
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 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
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 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 06
5
Single table inheritance
I''m having a class called Person, with subclasses as goalkeeper,
forward, defender.
Now a person can be a forward as well as a defender or a goalkeeper.
I want to use single table inheritance like :
class Goalkeepr < Person
end
And not have multiple boolean columns like in my people table like is
is_goalkpeer, is_forward, is_defender.
How do I go about it ?
Thanks,
Pratik
--
rm
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:
2006 Jan 13
4
Single Table Inheritance (this is my 3rd post :( )
Hi Everyone,
I hope I get some feedback on my question. Here it goes.
I have a situation here, I have a company table and then using Single
Table inheritance it is of 3 types:
class Company < ActiveRecord::Base
end
class Vendor < Company
end
class Customer < Company
end
class Agent < Company
end
Now I have a active record Association
class QuoteSheet < ActiveRecord::Base
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 =
2005 Dec 19
8
Single Table Inheritance question
Hello,
I''m having a heck of a time getting Single Table Inheritance to work in my app.
I have the following models and have scaffolded out Person and Contact.
person.rb
class Person < ActiveRecord::Base
has_many :contacts
end
client.rb
class Client < Person
end
contact.rb
class Contact < ActiveRecord::Base
belongs_to :person
end
phone.rb
class Phone < Contact
end
In
2009 Oct 13
2
Single Table Inheritance (STI) Broken: NameError
Some how I''m getting NameError: uninitialized constant when accessing a
child models that inherits form the parent model. However, if I access
the parent model first, then the child model is resolved.
What am I doing wrong? My steps are below...
Thanks,
Francis.
> ./script/generate model Blah type:string
class CreateBlahs < ActiveRecord::Migration
def self.up
create_table
2006 Feb 26
0
error Before updating scaffolding?
Hello all, I am a bit hung up.
I have created a simple table (pluralized) named aircrews and I have edited
my database.yml file to point to the database that I created and that is
holding the table aircrews.
I have gone through the depot tutorial in the Agile book and when I have run
the scaffolding command for the depot app all has worked fine for the table
products.
Now when I run the ruby
2006 Aug 15
0
ActiveRecord inheritance with types table
I have a Field class:
class Field < ActiveRecord::Base
belongs_to :field_type
end
with it''s table:
fields:
id
field_type_id
name
ordering
every field has a type
class FieldType < ActiveRecord::Base
end
stored in the field_types table
field_types:
id
name
class_name
for each field type, there''s a subclass of Field that do whatever
special
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])"
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
2006 Feb 21
2
Single table inheritance problem
Hi!
Is there anywhere on the net a sample of some basic app (with actions
like create, edit etc.) that uses single table inheritance?
I''m trying to create (my first) app with 2 different types of users and
while it basically works, my code is quite messy.
I.e. i''ve got 2 forms, each for different type of user. To use the same
rhtml files for creating and editing the user, i
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 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 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