In playing around a little with SQL, I've found that I can perform this query that gets me close to what I'd like, with a bit of processing:
select stores.id, stores.name, utms.name from stores left join utms on stores.id = utms.store_id The results from sqlite shows: 1|167| 2|191|02:05:06:08:07:08 In this situation, store 167 does not have a UTM assigned, and store 191 does. I'd only want the records that had empty values returned for the utms.name column. (Except that I'd also want the one that was assigned to this particular UTM) I've found options_for_association_conditions, which looks like what I want to filter this, but I'm not familiar enough with Ruby to translate this SQL into what I want... (though I'd prefer a better, more general API supported way) Any help there would be greatly appreciated. As a stop gap, I've implemented some validations to make sure the same store doesn't end up getting two different UTMs assigned to it, like so: validates_uniqueness_of :store_id, :allow_nil => true --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en -~----------~----~----~----~------~----~------~--~---
