Displaying 20 results from an estimated 560 matches for "polymorph".
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 :link...
2006 Jul 10
2
Polymorphic associations in reverse?
...A User has many Images. (Yes, another
picture sharing app, but it''s for a small niche, and it doesn''t end
in -r!)
I would like to express a "Favorite" relationship between both Users
to Users, and Users to Images. This seems like the opposite of the
standard polymorphic model, i.e. tags and taggable, where a Tag may
apply to many different types of Thing.
Perhaps I''m not thinking of it properly, but this was my first stab
at the relationship:
###############################################################
class Image < ActiveRecord::Base
# C...
2009 Feb 18
2
[LLVMdev] Parametric polymorphism
> Why do you say that people who compile, e.g., functional languages
> would benefit from type variables in LLVM?
> I like the level the LLVM is at, and would prefer to deal with
> instantiating parametric polymorphism at a higher level.
I'm surprised you're happy with a non-polymorphic llvm. Does
Cayenne target llvm? Dependent types take polymorphism to new
heights -- but perhaps you feel that since llvm cannot hope to
match Cayenne, you might as well do everything yourself. :-)
My reasons are:...
2012 Sep 08
3
Polymorphic has_and_belongs_to_many association
Hi,
I''m currently having the situation where I have to implement a polymorphic
has_and_belongs_to_many by introducing an in between model that handles all
the "has_many :as" and "belongs_to :polymorphic" association
implementations... and is not doing anything else. Thing I don''t like it
here is, I am unnecessarily loading AR instances only...
2006 Jul 26
3
Polymorphic Association with Single Table Inheritance?
...^
| |
User UserGroup
I tried the following but failed:
Groupable (table with ''type'' column)
has_many :memberships, :as => :groupable
has_many :groups, :through => :memberships
Membership
belongs_to :groupable, :polymorphic => true
belongs_to :group, :polymorphic => true
Group (table with ''type'' column)
has_many :memberships, :as => :group
has_many :groupables, :through => :memberships
And the inherited tables:
User < Groupable
has_many :user_groups, :through => :memberships...
2006 May 24
0
polymorphic url and polymorphic partial helpers
Here are a couple of articles I wrote describing a couple of handy
helpers for dealing with polymorphic objects.
These helpers allow you to generate urls and render partials on objects
without knowing what class they are ahead of time.
http://www.sciwerks.com/blog/2006/05/24/polymorphic-urls/
http://www.sciwerks.com/blog/2006/05/24/polymorphic-partials/
Hopefully you will find them useful.
_K...
2007 Sep 18
2
Making attachment_fu polymorphic
I am working on a small model mixin called attachment_kung to make
attachment_fu polymorphic, so you no longer need a different table and
Model class for every associated attachment (Productimage, Ad_doc,
etc). All you really need is one model and table to handel all your
attachments - in some cases, anyway. I have the code working, but have
run into one small hitch that I can''t...
2006 Feb 10
3
[Req] polymorphic associations howto
Hi people,
I''m looking into polymorphic associations as a way to cleanup some
messy parts of my code. I think they will allow me to do exectly what
I need, but since there''s little to none written on this subject, I''d be
delighted if someone could shed some light on this. Especially what
the different options and...
2006 Mar 19
2
Multiple polymorphic belongs_to declarations
I have the following models:
class Card < ActiveRecord::Base
belongs_to :deck
belongs_to :front, :polymorphic => true
belongs_to :back, :polymorphic => true
end
class TextContent < ActiveRecord::Base
has_one :card, :as => :front
has_one :card, :as => :back
end
The conflicting has_one declarations don''t work. What I need is a way to
name the belongs...
2006 May 21
3
has_many :through with a polymorphic join
Hi,
Four tables: users, user_counties, uk_counties and us_counties.
Each user has many counties, and each county has many users, so I
decided to make user_counties a polymorph, so it can have counties
from different countries (each country requires a completely different
set of tables with a completely different set of properties, that''s
why there''s one table for uk_counties and one for us_counties, with
more to follow when more countries are supported)...
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
"admin...
2009 Nov 01
1
please help - complicated polymorphic association
I am trying to build a shared-appointment system, where users can
subscribe to appointments and be updated whenever changes are made to
them. I have three objects in this system, appointments, users, and
subscribers. Subscribers are a polymorphic object like so:
class Subscriber < ActiveRecord::Base
belongs_to :user
belongs_to :subscribable, :polymorphic => true
end
The tricky part is that users already own appointments, so I can''t
create a simple users.appointments association. I can find users by
calling appointment...
2010 Feb 08
5
Why are double sided polymorphic relationships lacking in Rails?
http://stackoverflow.com/questions/2224994/why-are-double-sided-polymorphic-relationships-lacking-in-rails
--
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 t...
2007 Dec 27
6
ActiveResource and (polymorphic) associations
Hi,
I''m just playing with ActiveResource and I did''nt find anything about
the support of (polymorphic) associations.
Is there a support at all?
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-/JYPxA39Uh5TLH3...
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 is my
setup:
User (table Clients: basic user stuff belonging to a functional STI
relationship)
==========...
2006 Mar 31
2
"Owning" a polymorphic
...''m having trouble figuring out how to
describe a certain relationship. I''m building a social networking site
where you have users who can comment on other users, photos, videos, and
blogs. I''ve figured out how to have a comment belong to a user or media
item through a polymorphic relationships but I dont'' know how to have
the comment also be "owned" by the user who made the comment. I''ve
included some code to help with the description:
#User class
class User < ActiveRecord::Base
has_many :photos
has_many :blogs
...
end
#photo (also blog...
2009 Feb 18
0
[LLVMdev] Parametric polymorphism
Why do you say that people who compile, e.g., functional languages
would benefit from type variables in LLVM?
I like the level the LLVM is at, and would prefer to deal with
instantiating parametric polymorphism at a higher level.
On Wed, Feb 18, 2009 at 10:43 PM, DeLesley Hutchins
<delesley.spambox at googlemail.com> wrote:
>> I think many people were confused by this at first but an excellent counter
>> example was provided in a previous thread: C99 ABIs can require that struct
>...
2009 Feb 19
0
[LLVMdev] Parametric polymorphism
...Wednesday 18 February 2009 23:36:27 DeLesley Hutchins wrote:
> > Why do you say that people who compile, e.g., functional languages
> > would benefit from type variables in LLVM?
> > I like the level the LLVM is at, and would prefer to deal with
> > instantiating parametric polymorphism at a higher level.
>
> I'm surprised you're happy with a non-polymorphic llvm. Does
> Cayenne target llvm? Dependent types take polymorphism to new
> heights -- but perhaps you feel that since llvm cannot hope to
> match Cayenne, you might as well do everything yourself....
2006 Jul 26
1
Polymorphic Associations: dynamic finders
Is there any sort of dynamic finder for polymorphic associations?
For example if I had:
class InviteNode < ActiveRecord::Base
belongs_to :inviteable, :polymorphic => true
end
I would like to be able to search by:
InviteNode.find_by_inviteable(some_object)
instead of having to do:
InviteNode.find_by_inviteable_id_and_inviteable_type(s...
2006 Feb 15
2
Polymorphic joins work one way, but not the other
I''ve been using polymorphic joins from edge rails based on about 5 lines
of advice Rick Olson gave me over IRC. There''s some sparse documentation
popping up but it seems to cover a somewhat different case.
Anyway - I pretty much got it to work - save for one detail. Here''s what
I have:
class Event <...