Hi, First of all, since this is my first post to this list, I'd like to say thank you to all the DataMapper developers for this wonderful library.
I am using edge DataMapper (d949fea390f338f3aaedc7f4f2cc6388af285279) and trying to order a collection based on a property belonging to the ":through" model. The simplified code (for ruby1.9) looks like this: class Image property :id_local, Integer, key: true has n, :tag_images, child_key: [:image] has n, :tags, through: :tag_images end class Tag property :id_local, Integer, key: true has n, :tag_images, child_key: [:tag] # [1] has n, :images, through: :tag_images # [2] end class TagImage belongs_to :tag, child_key: [:tag] belongs_to :image, child_key: [:image] end Please don't pay too much attention to the naming of the properties since this I don't control the SQL schema (for the curious, I'm trying to map the Lightroom SQLite schema). I would like to get Tag.first.images and have that collection ordered by :position_in_collection (inTagImage) but don't know where to put that condition. I have tried to put "order: :position_in_collection" or "order: :positionInCollection" on [1] and [2] but this doesn't work: .../query.rb:947:in `block in assert_valid_order': +options[:order]+ entry :position_in_collection does not map to a property in Image (ArgumentError) I've looked in the docs and can't seem to find an example. Is this even a feature? :) If not, is there a(n elegant) way around it? Thank you. -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
