similar to: single-table inheritance and select

Displaying 20 results from an estimated 10000 matches similar to: "single-table inheritance and select"

2006 Oct 13
1
Edge rails, single table inheritance and keeping multiple classes in a single file
So is the official stance as per edge rails that multiple class definitions must go into separate files? I was trying to use STI with acts_as_attachment, to have all my attachment classes go into a single file, for example: attachment.rb class Attachment < ActiveRecord::Base end class UserPicture < Attachment belongs_to :user, :foreign_key => ''owner_id''
2006 Mar 18
1
Fixtures and single table inheritance
I''m wondering what the accepted method for doing unit tests on STI models is. I tried to create a fixture for the class but Rails tries to load that data into the non-existent child table. I could create a fixture named for the real, parent table, but then it would be very difficult to test for the individual functionality and integrity of each sub-class. I saw this page
2010 Nov 21
1
reference classes: question on inheritance
Dear list, I have a reference class which should act as a "generic" superclass for other classes. I've read the respective section at ?setRefClass and put the name of the superclass to the 'contains' argument of an example subclass (see class defs below). Classnames are set in a way that shouldn't result in collation issues (virtual def sourced before superclass def
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
2007 Nov 14
1
New Foxy Fixtures (Rails 2) & STI (Single Table Inheritance)
I''ve got some problems right now using the new model for relationships in fixtures (by label, not by id) and STI. What I''ve got, is a couple of models: Attachment --> FileDownload Version Version has_one file_download with file_download_id on the versions table In my fixtures, I have two FileDownloads in my attachments.yml like so: hemingway_alpha_zip: size: 100
2006 Jul 26
3
Polymorphic Association with Single Table Inheritance?
Hello, is it possible to setup a model/table schema like this: Groupable --> Membership <-- Group ^ ^ | | User UserGroup I tried the following but failed: Groupable (table with ''type'' column) has_many :memberships, :as => :groupable has_many :groups, :through => :memberships
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 Apr 03
1
Single table inheritance and relations
All, I''ve a question concerning STI in Rails. Let''s say I''ve a Person class and two classes that inherit from Person: User and Customer. In the DB I''ve the people table to store both instances of User and Customer. Now, let''s say I also have Address class, which references a Customer, and each customer has many addresses. How should I name the
2006 Jan 06
3
Single table inheritance - HowTo?
Hi, As per another member''s suggestion, I''m trying to user STI. So I have this table: CREATE TABLE `settings` ( `id` int(11) unsigned NOT NULL auto_increment, `type` char(40) NOT NULL default ''General'', `name` char(40) NOT NULL default '''', `value` char(128) NOT NULL default '''', `updated_on` datetime default NULL,
2007 Jul 22
4
single table inheritance problem
Hallo, I am having a very strange Problem with STI in my application. setup: - two tables one called "wikis" on called "categories" with a hbtm relationship. - the wikis table is the sti one with a model PageWiki being extended from Wiki (and the correspondig type column) Following happens: - server restart - get :wikis, :show_pages - in show_pages the first line says
2006 May 21
2
acts_as_taggable and single table inheritance
I''ve set up a couple of STI models like such that we get something like this... class A < AR:Base class B < A acts_as_taggable class C < A acst_as_taggable (using the acts_as_taggable plugin) I can tag things just fine this way, the problem I encounter is that the taggings are listed with the base class ("A") and not the appropriate subclass ("B"
2005 Sep 29
0
Single Table Inheritance and rhtml docs
Is there any way to wire the .rhtml files in app/views into Rails'' Single Table Inheritance mechanism? So given: class Bar < Foo The STI mechanism is generating the objects correctly when it hydrates them out of the db, but when it goes to rendering pages, it pulls everything from app/views/foo and doesn''t touch app/views/bar. I can of course hook in manual type-checking
2008 Oct 06
2
Filter inheritance
can anyone tell me how before filter can call the private method audit which from the parent class ? because the bank controller has a private method called audit, this one should not be inheritance by VaultController, so how the before_filter use the private method audit ? if the child class can use the parent class private method . does it break encapsulation ? does the private has any sense
2005 Dec 29
9
Single Table Inheritance
Hi all, Quick question for STI. With the following setup: class Company < AR::Base; end class Firm < Company; end Why does Firm.find(:all) return all Companies, not just those that have type==''Firm''? -- Alex
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
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
2009 Aug 17
2
S4: inheritance of validity methods?
Dear Developers, In current implementation of validity method, objects are first coerced to superclass (slots are striped). Thus, it is not possible to write validity method which would perform some checks on children slots. Say, I want to check if number of slots in a class is equal to "n": setClass("A", representation(a="numeric", n="integer"),
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 14
0
Reference class inheritance using matrix/array class
Hi, I'm investigating converting some S4 classes to reference classes and have a question about inheritance. The primary data structure for the original S4 class is a 3-d array. Using the "contains" parameter when defining the class permits me to inherit all of the array-related methods. Of particular utility for me is the ability to access the array via [] indexing. It all works
2010 Apr 24
3
S4 Inheritance of environments
I looked through the documentation and the mailing lists and could not find an answer to this. My apologies if it has already been answered. If it has, a pointer to the relevant discussion would be greatly appreciated. Creating S4 classes containing environments exhibits unexpected behavior/features.? These have a different in two ways: 1) slotName for the data: ".xData" instead of