Displaying 20 results from an estimated 8000 matches similar to: "100% polymorphism problem, hmm not so sure."
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
2012 Mar 22
1
why doesn't .where() honor polymorphism?
I love the query interface (ActiveMethod::QueryMethods), but one thing
has bugged me: why doesn''t it generate calls for polymorphic
associations? For example:
class MyModel < ActiveRecord::Base
belongs_to :parent, :polymorphic => true
end
I would expect:
MyModel.where(:parent => a)
to be equivalent to:
MyModel.where("my_models.parent_id = ? AND
2006 Mar 27
1
polymorphism + inheritance
Hi,
currently I do some work with polymorphic associations in egde rails
class Order < ActiveRecord::Base
belongs_to :payment, :polymorphic => true
end
class CreditCardPayment < Payment
end
class PayPalPayment < Payment
end
class Payment < ActiveRecord::Base
has_one :order, :as => :payment
# common stuff in here
end
I want to use [Payment] for common functionality
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
2012 Apr 05
0
Polymorphism, acts_as_relation gem and nested attributes
I have the following polymorphic association set up with
acts_as_relation (https://github.com/hzamani/acts_as_relation)
Model code:
class Email < ActiveRecord::Base
belongs_to :detail
validates_presence_of :address
end
class Detail < ActiveRecord::Base
acts_as_superclass
has_many :emails
accepts_nested_attributes_for :emails, allow_destroy: true
2009 Feb 19
0
[LLVMdev] Parametric polymorphism
On 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
2015 Jan 27
2
[LLVMdev] RFC: Introduce a section to the programmers manual about type hierarchies, polymorphism, and virtual dispatch.
The proposed addition to ProgrammersManuel.rst is below the break...
This is essentially trying to explain the emerging design techniques being
used in LLVM these days somewhere more accessible than the comments on a
particular piece of infrastructure. It covers the "concepts-based
polymorphism" that caused some confusion during initial reviews of the new
pass manager as well as the
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.
2008 May 28
1
Attachment_fu, polymorphism and customization
Hi,
I got Image model that has_attachment and belongs_to 2 other models
via polymorphic association.
The problem is that I''d like to customize has_attachment options
(resize image) depending on which model the Image is related to - i.e.
if Image belongs to Article it should be resized using different
settings than if it belongs to Header.
Is there a smart way to do it or do I have to
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 to execute SQL
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 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
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 seem to
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 <<
2009 Nov 12
0
Problem with has_many :through, :uniq => true with polymorph
Didn''t have quite enough space to describe it there...basically i''m
having a problem with the :uniq option in my tags.
I''m using acts_as_taggable_on_steroid which adds these associations to
my Resource class:
Resource
has_many :taggings, :as => :taggable, :dependent => :destroy, :include
=> :tag
has_many :tags, :through => :taggings, :uniq => true
2009 Feb 18
0
[LLVMdev] Parametric polymorphism
On Wed, Feb 18, 2009 at 12:32, DeLesley SpamBox
<delesley.spambox at googlemail.com> wrote:
>> I think the problem is deeper than that, in that LLVM has no official
>> concept of a subtype, so I don't see how the idea of polymorphism
>> could be defined in it.
>
> Parametric polymorphism is different from subtype polymorphism; you
> can have one without the
2006 Mar 02
1
Fixture accessors broken for polymorphism, in need of redesign
Ticket 4052 (http://dev.rubyonrails.org/ticket/4052) just came through
trac, which introduces the need for a better way to access fixtures. I
believe the basic problem is the same as 3935
(http://dev.rubyonrails.org/ticket/3935) in that the accessor method
which is constructed by the fixture call can''t infer the class name
from the table name. The band-aid in 3935 was to allow you to
2010 Apr 25
1
method dispatching vs inheritance/polymorphism (re-post)
Hi,
I'm having trouble seeing the added value over functions defined by setGeneric vis-a-vis
methods defined by inheritance and polymorphism. setGeneric offers a 'clean' call to a generic function, ie. no need to call new(), so less typing to do for the user. But such explicit calls can also be avoided by functions like f <- function(x, y) new(Class = SomeClass, x=x, y=y). Then
2009 Feb 18
2
[LLVMdev] Parametric polymorphism
> I think the problem is deeper than that, in that LLVM has no official
> concept of a subtype, so I don't see how the idea of polymorphism
> could be defined in it.
Parametric polymorphism is different from subtype polymorphism; you
can have one without the other. Parametric polymorphism just means
that you can use type variables (like T) in the IR, which are later
instantiated
to