similar to: Single Table Inheritance and rhtml docs

Displaying 20 results from an estimated 10000 matches similar to: "Single Table Inheritance and rhtml docs"

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 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
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
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 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 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,
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"
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
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
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 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 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 Aug 30
1
Single Table Inheritance with self-referential join
Please tell me if this train of thinking makes sense, I need help on solving this association model problem: I am doing an app that creates and manages stereoscopic images, one stereoscopic image is formed by two photos, say photo1 and photo2 The user uploads photo1 and then photo2 and gets a preview if he likes the preview he/she authorizes it and gets a final stereoscopic image All this
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
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 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
2009 Jun 29
3
Table Inheritance based on a function
Hello, we have a problem in a CMS project that we believe is basic for RoR developement and could concern others as well - or have already: RoR implements the ''Single Table Inheritance'' (STI) Pattern: http://www.martinfowler.com/eaaCatalog/singleTableInheritance.html .. through its ''ActiveRecord'' ORM. The Fowler example mentions a ''type''
2006 Jul 31
3
Polymorphic associations and single table inheritance
Running into an interesting problem that at first glance appears to be a bug in the AR association code. However, it''s explicitly coded this way so I''m not so sure. I have some code like this: class Address < ActiveRecord::Base belongs_to :addressable, :polymorphic => true end class Person < ActiveRecord::Base has_many :addresses, :as => :addressable,
2006 Jul 20
11
Any good alternative to single-table-inheritance?
I''m looking to implement model inheritance in a new application. Is there any good alternative to single-table-inheritance? -- -Alder