Displaying 20 results from an estimated 20000 matches similar to: "STI vs Polymoric"
2006 May 14
2
object class with STI and Polymorphic Assoc''s.
Hi, lets say I have a a table, "Linkings" that I am using for
polymorphic associations. One of the associations is to the "person"
table, and there are several other associations.
"Person" has 2 types, "slacker" and "suckup".
It is modelled as such:
class Linking < ActiveRecord::Base
belongs_to :person
belongs_to :linkable, :polymorphic
2007 Aug 02
2
STI functionality, but then with multiple tables
Hello,
I''m creating my own Tumblr [tumblr.com] like rails app.
It''s like a blog, but in this case a blog post could be of a certain
type, i.e. a regular post, a video, a link, a photo, a song(info).
Well now, it''s clear that they share a lot of similar functionality:
title, created_at/updated_at, commentable, probably has an author_id,
etc..
But besides that they are
2012 May 10
6
Is it suitable using STI?
I have problems on a simple design problem.
I have many companies. Each company have one or more commercial activity.
Activities types are: ecommerce, local unit, television, automatic
vending machines, and so on.
Company may have one or more ecommerce activity or one or more local
unit activity, one ormore vending machines, etc.
How can I model this scenario?
Company has_many ecommerce has_many
2008 Jun 06
1
STI vs Polymorphism
Hello everyone,
I am racking my brain with a modelling question and can''t wrap my around
the benefits of STI or Polymorphisms.
I am trying to model Questions and Answer behavior but I think I am not
using rails full power here.
I have (in simple terms)
Question
has_one Answer
Answer
belongs_to Question
I also have
Topic
has_many Posts
Post
belongs_to Topic
Now i am
2006 Feb 06
4
Relationship Question (STI)
My girlfriend and I have been dating for two years, and she just told me she
has an STI...
Actually, I currently have three different models, like: Dog, Whale, Monkey
They all have some similar attributes, but, they are unique enough to
break into their own models. I could use STI, but I think the table would
just have too many columns.
Now, I wanted to let the Dog''s, Whale''s
2010 Aug 10
4
(Dreaded) STI, belongs_to
Having problems with STI. Names below have been changed to protect the
innocent. Imagine a system that allows someone to apply for one of two
different types of school scholarships. Each scholarship goes through a
different review process, represented by a state machine (this is not a
state machine question). So there are two state machine classes that
differ slightly and subclass a generic
2009 May 12
2
STI good or bad for my problem?
Hi. I am currently developing a small course system for student and
teachers. The system is divided in sections and sections have many
messages, comments, documents and schedules. Pretty easy to set up
using ROR, just add some belongs_to and has_many relations. But
everything becomes much more complicated when the section items
(message, comment and so on...) all has comments. And they can also be
2010 May 07
1
Can't eagerly load a polymorphic association defined in an STI parent class?
If I define an association (in my case a polymorphic one) in an STI
parent class, and try to eagerly load it in a subclass, I get the
following error:
ActiveRecord::ConfigurationError: Association name ''myassoc'' was not
found; perhaps you misspelled it?
If I redefine the same association again in the STI subclass, it
works.
Is this a bug or what?
--
You received this message
2010 Jul 08
2
Paypal Integration
Hi all
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
2011 Apr 05
1
Why does AR use base_class for polymorphic relationship "type"
I have a couple models that inherit from a base class that then
inherits from AR.
When they are used in a polymorphic relationship the "type" is always
the base class.
Just curious if anyone has a reason why it doesn''t use the *actual*
class rather then the base_class. I have patched AR to use the actual
class if !base_class.table_exists? but it adds another query each time
2011 Jul 20
2
polymorphic assoc seems only best for multiple parents ?
I have done a little polymorphic associations stuff and have
refreshed my memory on it again.
What it seems like is that if I have a particular record and I want to
make it easy for many different parent records to associate with it
using has_one or has_many, that is fine.
If I want a parent record to have multiple kinds of children through
one association, I don''t see how to do that
2006 Feb 09
2
Polymorphic Associations
If anybody on edge familiar with this could help, that would be "great" :)
I have different types of things I want to be "reviewable". So, instead of
having a slew of HABTM... this new Polymorphic Associations schtick seemed
like the best solution. I have everything setup as I thought it should be
(so I think)... but it doesn''t appear to be working correctly. Here
2006 Sep 22
2
possible to create polymorphic relationship with STI models?
I would like to associate a ‘product’ model with 3 models inherited from
‘image’: part, action and accessory.
I have it working with Has_many :through relating products to images
through attachments, I then have to determine the ‘type’ of the STI
extension. This means i have to go product.images. While this is ok, i
can see it getting tricky when i want to go products.images <<
2011 May 03
2
Database performance for polymorphic associations under high load
Hey guys,
I''ve been thinking lately about polymorphic associations, and I
wonder: is there a noticeable or tangible performance "hit" from doing
polymorphic associations when you''ve got your database under really
high query load?
So for example, maybe I have a "message" model, a "user" model and an
"administrator" model, without any
2007 Oct 27
0
STI vs Polymorphic Associations
I have a MasterEvent model. It has attributes that is required by
another model Event. The user selects the MasterEvent model and I
create the Event model by merging the attributes of the selected
MasterEvent with the attributes that were presented for the Event
model in the form.
I have association declarations in the MasterEvent and Event models.
If I use STI does the subclasses inherit the
2011 Aug 10
3
STI Devise, remove sign up for admin
Hi,
If I''m using STI with Devise, I have a Admin model inheriting the base
Devise User model. I would like to remove ''registerable'' from the
Admin model but it inherits registerable from the user model. How
would i disable registration for admins?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To
2006 Jun 17
5
STI versus Composition...or the headaches of one big table
Guys,
I have a relationship between model classes that I believe is best
represented by inheritance, but the likelihood that things will change
often is driving us to composition instead.
So, I have a class called Autos, and subclasses called Suvs, Minis,
Mids, Sports, for example.
We have been requested to avoid the STI approach to this, because of
fear of a quickly growing table with
2006 Apr 07
4
STI and foreign_key problem
Hi,
I am trying to use STI since my classes only vary by one column in the
database.
Here is the structure (names have been changed to protect the innocent):
Case
/ \
Registered Initial
\ /
Children
A registered case has additional information than an initial case (I
realize I could just set a flag to separate them, but there is a good
reason to separate
2011 Jul 08
0
Looking for Help/Advice on StackOverflow Question - Polymorphic Association with STI
I am having trouble with an many to many polymorphic association with
STI involved. The problem is described clearly in the following
StackOverflow question, so I will leave this thread short:
http://stackoverflow.com/questions/6582074/activerecord-has-many-through-polymorphic-associations-with-sti
I am posting here hoping to get advice/direction/a solution for this,
as I''ve so far been
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