2
我有圖片的查詢像這樣的Rails查詢屬性
pictures = Picture.near([latitude, longitude], 6.8).where("created_at >= :time",{:time => time })
,我拿出一個與此模型(每一個畫面的has_many:標籤)相關聯的標籤,像這樣
@tags = Tag.find(:all, :conditions => ["picture_id in (?)",pictures.collect(&:id)])
如何我是否會使用查詢來提取每個標籤的屬性(即我的標籤有一個屬性tagcontent,我需要在activerecord查詢中提取所有這些內容)
類似於@ tags.map(&:tagcontent)'? –
@AlbertoSantini謝謝,這工作 – jack