similar to: [PATCH] Polymorphic belongs_to association with :conditions issues

Displaying 20 results from an estimated 3000 matches similar to: "[PATCH] Polymorphic belongs_to association with :conditions issues"

2010 Sep 08
1
Unintended side-effect from before_remove_const?
Hey all, In troubleshooting a failing test for MetaSearch against 3-0-stable, I came across some undesirable (from my side, anyway) behavior in http://github.com/rails/rails/commit/bf87528b53f1422708ec0188d126cfca824ddc5c. A simple one-liner, it would appear, but AR::Base implements before_remove_const to do a bit of scoped method cleanup... It''s the only thing I can see that might
2010 Oct 25
1
A few fixes to eager loading issues
Hey all, I''d really appreciate some eyes on https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/5845-activerecord-3-eager-loading-fail#ticket-5845-19. There''s a small issue in Rails 3 eager loading, and this ticket has an accompanying patch. Sssociations that show up twice in a Relation chain like: Article.includes(:comments).includes(:comments =>
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 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
2008 Jun 12
1
unidirectional belongs_to polymorphic
The setup: class Location::Base < ActiveRecord::Base set_table_name :locations ... end class Location::Address < Location::Base ... end class Location::Airport < Location::Base ... end class Person < ActiveRecord::Base belongs_to :location, :polymorphic => true, :class_name => "Location::Base" ... end I want a unidirectional belongs_to relationship. That
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 Feb 08
4
Remove ActiveRecord::Relation#& alias for 'merge' ? (or at least only reference and not use in AR)
Would the core team be open to the removal of the ''&'' alias for ActiveRecord::Relation#merge? The reason is that in Ruby the ''&'' operator refers to an intersection of two sets of data, not a merge. (within the context of the Array class) Recently Arel added support for SQL Set Operators: 2-0-stable:
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
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
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 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
2012 Jan 18
2
Polymorphic and standard association issue
Hello all, I''m having a strange issue with a model that belongs_to two other models. The one association is polymorphic and the other is normal. ================================ class Role < ActiveRecord::Base belongs_to :user belongs_to :permission, :polymorphic => true end class User < ActiveRecord::Base has_many :roles has_many :programs, :through => :roles end
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
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
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 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/.