This project is archived and is in readonly mode.
Added the ability to have a polymorphic in a conditions hash
Reported by Mark | July 27th, 2008 @ 01:37 PM | in 2.x
Pretty simple enhancement:
If you have:
class Tagging < ActiveRecord::Base
belongs_to :taggable, :polymorphic => true
class Post < ActiveRecord::Base
has_many :taggings, :as => :taggable
You can do:
Tagging.find :all, :conditions => {:taggable => Post.find 1 }
and you will get a find with this sql along the lines of:
SELECT * FROM taggings WHERE taggable_id = 1 AND taggable_type = 'Post'
Comments and changes to this ticket
-
nikz July 27th, 2008 @ 10:34 PM
Hey Mark,
Check out:
http://rails.lighthouseapp.com/p...
and
http://rails.lighthouseapp.com/p...
and the associated mailing list discussion :)
Is this a duplicate of some of those?
Cheers,
Nik
-
Tarmo Tänav September 18th, 2008 @ 06:19 AM
- State changed from new to duplicate
- Tag changed from activerecord, enhancement to activerecord, enhancement
Looks like a duplicate of #467
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>