Displaying 20 results from an estimated 3000 matches similar to: "STI vs Polymorphism"
2006 Mar 08
0
combining STI + polymorphism + rich self HABTM : how to ?
Hi all,
I need to model simple typed polymorphic relations:
''John'' [''works_for''] ''Bill''
''John'' [''speaks_for''] ''Microsoft''
''Microsoft'' [''hold_shares_of''] ''Apple''
I''m having a hard time combining :
- S.T.I.
2006 Nov 04
0
[PATCH] #6040 STI and Polymorphism docs
Hi,
I have had several emails from people thanking me for the following
documention patch.
http://dev.rubyonrails.org/ticket/6040
Any chance this could be commited so more people can find it?
Peter
2008 May 16
3
has_one and find_by_id issue
I have two models:
testamonial
photo (has_attachement)
testamonial has_one photo
The issue is when do this:
@testamonial = Testamonial.find_all_by_id(id)
I get "undefined method `photo'' for" in my browser?? BUT here is the
big kicker....
If I do @testamonial = Testamonial.find(:first)
everything works fine and the image is show!.. (find :all works too
when I loop
2013 Jan 22
2
SNPRelate package error
Dear,
I am using the R package SNPRelate but I found an error when I run the
following command. Do you know what might be the problem? Thanks in
advance.
> vcf.fn <- system.file("extdata","str.vcf",package="SNPRelate")
> snpgdsVCF2GDS(vcf.fn,"test.gds")
Start snpgdsVCF2GDS ...
Extracting bi-allelic and polymorhpic SNPs.
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
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 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
2008 May 12
0
Problems with form_for, STI, and polymorphic routing
I''m stumped on how to get past this. It''s Rails 2.0.2.
I have a class, Show. Using STI, I''m using that as a base class, and
have DayShow and NightShow that inherit from it.
###
class Show < ActiveRecord::Base
end
class DayShow < Show
end
###
In my shows/edit.html.erb, I have:
<% form_for(@show) do |f| %>
However, when I use it with a @show that has
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
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
2006 Apr 05
4
How to do IN(?) query?
I''m trying to do an IN query, where I have an array of user objects
imaginatively named ''users'':
:conditions=>["user_id IN (?)", users.collect{|u| u.id }.join('','')]
this ends up with:
... IN(''1,2,3'') ...
Obviously I want this to be:
... IN(1,2,3) ...
or even
... IN(''1'', ''2'',
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
2008 Jul 17
2
problems with validation on STI
I have the following STI table:
def self.up
create_table :distributions do |t|
t.string :type
t.integer :simulation_id
t.string :dist_name
t.string :desc, :default=> ''fixed''
t.float :param1, :default => 5.0
t.float :param2, :param3
t.timestamps
#fields for RscDist
t.integer :resource_id
#fields for LoadDist
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
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
2010 Jul 09
1
STI vs Polymoric
Hi all,
I am also which one will be better STI or polymorphic for my app.
thanks in advance
--
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
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
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
2005 Jun 01
4
list down?
List doesn't seem to be posting out - still active here
http://lists.digium.com/pipermail/asterisk-users/2005-June/date.html but
not being received by email (time warner is the isp but other emails
coming in every few minutes as per normal).
Cheers,
Dean
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
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