Displaying 20 results from an estimated 2000 matches similar to: "Best practice - polymorphic or not"
2007 Oct 10
1
Scraping AOL Webmail to login and fetch contacts?
I''m helping with a gem that is going to published under the
contentfree project on rubyforge
(http://rubyforge.org/projects/contentfree/).
The gem is called "blackbook" and basically it will go and fetch your
contacts from the major webmail providers. So far Gmail, Yahoo!, and
MSN have been completed.
We are trying to finish up with fetching contacts from AOL Webmail.
However
2009 Feb 05
1
Question about mount.cifs and smbclient
Hi!
I have a problem for a few weeks, and can't figure out what could be the
problem.
The client computer runs RHEL 5.2 (arch: x64_64); the smb server is
unknown for us.
I'm sorry, that I can't provide any info (usernames, servernames, IPs,
etc), they are masked to look like variables. But they are correct as
far as i am concerned.
When I try to mount it with mount.cifs (.smbfs
2006 Jul 17
3
libvorbis 1.1.3
hey,
i am running freebsd and i?ve got the following problem with installing
icecast 2.3.1.
(libxslt-1.1.0 and libogg 1.1.3 is installed) but when i am trying to
install libvorbis 1.1.3 i always get this message:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Package ogg was not found in the pkg-config
2006 Jul 17
2
actionmailer / @recipeints
Hi all,
i''m trying to email multiple people based on certain criteria.
i do a search like
@stacks = Group.find(:all, :conditions => ["component_id = ?", 2])
this populates stack to contain multiple groups with component_id =2.
How do i populate @recipients to contain all possible @stack.email.
Let me clearify. Each stack has its own email, and i need to include
each
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.
2006 May 08
2
Noob Question - Variable Scope
I feel awful asking such a basic question, but here it goes....
I have a controller, "NewsController".
The user enters and the "list" action is called and I populate an
instance variable "@news" which contains all the elements I''d like to
display using a form.
The user then changes something and the "update" action is called.
Is
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
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
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 needed table structures need to be.
Thanks,
-
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(some_object.id,
some_object.class.name)
obviously I
2006 Jul 10
2
Polymorphic associations in reverse?
My app has an association that''s got me scratching my head.
I have Users, and Images. 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
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
2006 Mar 31
2
Eager loading of polymorphic associations
Polymorphic associations work great until I try to do some eager
loading through :include. In my example, the interface name is
":imagehaver". Here''s my little eagerly loading find line:
Image.find(params[:id], :include => :imagehaver)
All it gives me is an ActiveRecord::EagerLoadPolymorphicError with no
further explanation. I haven''t been able to dig up anything
2010 Mar 01
0
undefined method for Polymorphic association using Searchlogic
I am unable to call a polymorphic scope using the searchlogic plugin
as it keeps on returning ''undefined method''. I am certain it is only a
problem within my project as I created a test project and I was able
to call a polymorphic scope using the searchlogic plugin.
I am hoping someone can provide a suggestion on how to debug this
issue.
My project consists of several gems, and
2008 May 13
0
Polymorphic naming difficulties
Hi all. I''m having a problem naming a polymorphic relationship. Here''s
my thinking...
First, an analogy. You''re walking through the mall. Through a window you
see a game you''re interested. I''m attempting to model the relationship
between your interest and the game you''re interested in.
I have an InterestList. It''s job is to maintain
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 May 21
3
acts_as_list scope and polymorphic association.
this is my model:
class Person < ActiveRecord::Base
has_many :phones, :as => :callable, :order => :position
end
class Phone < ActiveRecord::Base
belongs_to :callable, :polymorphic => true
acts_as_list :scope => :callable_id
end
how can i add the callable_type to the scope.
how can i say the scope is the {:callable_id,:callable_type} couple?
is it even possible?
thanks
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
2006 Apr 21
3
polymorphic,has_many through can not work?
Josh Susser tells in his blog that the opposite direction of polymorphic
will get into trouble together with has_many through.
This is the url:
http://blog.hasmanythrough.com/articles/2006/04/03/polymorphic-through
I do that according to Josh Susser''s procedure:
class Tagging < ActiveRecord::Base
belongs_to :tag
belongs_to :taggable, :polymorphic => true
belongs_to
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