Displaying 20 results from an estimated 5000 matches similar to: "Polymorphic and standard association issue"
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 to
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
2011 Jan 11
0
[PATCH] Polymorphic belongs_to association with :conditions issues
Hey all,
Could use a few eyes on a couple of very simple patches at https://rails.lighthouseapp.com/projects/8994/tickets/6262 if any has some time.
The issue (from the ticket description):
If you define a polymorphic belongs_to association and it has conditions on it, those conditions cause a NameError when you try to access the target object, of the style saying "hey, there''s no
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
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
2010 Apr 10
1
accepts_nested_attributes + polymorphic association
im having an issue where my my polymorphic associations arent being
deleted when using accepts nested attributes
there are other accepts_nested_attributes being used and they are
deleting fine, just the polymorphic association
before i go down the path of intense thrashing at this...is this a known
issue or problem?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because
2006 Apr 05
1
Validation error messages help please
I''m having problems with validation error messages appearing in my app.
In Controller:
def permissions
@roles = Role.find(:all, :order => ''name'')
end
def new_role
@role = Role.create(params[:role])
if request.post? and @role.save
flash[''notice''] = ''Successfully created a new Role''
redirect_to :action
2006 Apr 17
0
polymorphic association with single model as target
Hi,
I''m new to rails/ruby and not a sw programmer in the first place.
I''d like to use polymorphic associations to create tags/marks into
several dictionary tables (i.e japanese to english and japanese to
french) that share the same model. In that model I introduced a :target
field to select the database in a find query, i.e:
def self.find(*args)
for i in args
if
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
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 May 05
2
Dumb polymorphic association question
Hi,
Why is it that polymorphic associations only work with the :has_many
and :belongs_to relationships? Why can''t it be a :has_one?
Matt
2008 Jun 24
1
Get model from polymorphic association
Hi,
If using a polymorphic belongs_to, is it possible to access the "_type"
field that contains the name of the model ?
Thanks!
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
2011 Sep 04
1
polymorphic association
Hello,
I have a scenario where I want to save a author image and book image to
assets table...
I am using a polymorphic association.
And author_name is inside the books table.
now when I save the image the imageable_type says "Book" for both. And
off-course it''s a correct behavior, but I am just trying to figure out is
there any way where I can save author image and
2010 Oct 07
1
Question on polymorphic association
I have 3 models . Doctor, Patient and User
with following associations
class Doctor < ActiveRecord::Base
has_many :patients, :dependent => :destroy
has_one :user, :as => :userable
accepts_nested_attributes_for :user
end
class Patient < ActiveRecord::Base
belongs_to :doctor
has_one :user, :as => :userable
accepts_nested_attributes_for :user
end
class User <
2006 Jul 31
0
Polymorphic has_many association through a belongs_to
Hi,
Let''s say I''ve the following Models and their relative associations:
Seat
----
belongs_to :booking
Booking
-------
has_many :seats
has_many :debits, :as => :chargeable
Debits
------
belongs_to :chargeable, :polymorphic => true
Why
>> seat.booking.debits
nil
while
>> Booking.find(seat.booking_id).debits
[]
?
Thanks.
Cheers,
Marco
2006 Mar 26
0
Eager loading and polymorphic association
Hi all,
Is it possible to do "eager loading" with polymorphic associations ?
Ex : I have a Page model that acts as taggable. When I do
Page.find(:all), I would like to retrieve all tags associated with a
page.
Thanks,
Thomas.
--
Posted via http://www.ruby-forum.com/.
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 Mar 19
0
PGError "unknown column" on polymorphic association column
Hi all !
This is very strange. I am attempting to get my application running
on PostgreSQL (from MySQL), and I get this error:
ActiveRecord::StatementInvalid: PGError: ERREUR: la colonne «Party»
n'existe pas
: SELECT * FROM contact_routes WHERE (routable_type = "Party" AND
routable_id = 1000013) ORDER BY position DESC LIMIT 1
2010 Mar 29
0
Polymorphic association and has_one retrieval issues
class Address < ActiveRecord::Base
belongs_to :addressable, :polymorphic => true
end
class Client < ActiveRecord::Base
has_one :address, :as => :addressable
end
Now I''am able to create a correct entry in the db for address with
addressable_id = 1#client_id
addreassable_type = ''Client''
but when I retrieve
client = Client.find(1) --> return client