Thanks Chris, it works appreciate the help. On Nov 14, 1:53 pm, Chris Corbyn <[email protected]> wrote: > Sorry, scratch that, I can't read ;) > > Foo.all('configs.key' => 'key1', 'configs.value' => 'val1') > > I'm assuming that `key` is not actually the name of the field, since this is > probably not valid in SQL and is certainly reserved in DataMapper ;) > > On 14/11/2011, at 7:29 PM, Jason Hill wrote: > > > > > What does "config" map to here, is it the class which includes > > DataMapper::Resource or the table name? Thanks and appreciate all the > > help. > > > On Nov 14, 7:54 am, Chris Corbyn <[email protected]> wrote: > >> You can pass a string query path to #all, like this: > > >> Foo.all('config.key1' => 'val1') > > >> Assuming 'config' is the name of the relationship in Foo. > > >> Chris > > >> On 12/11/2011, at 4:47 AM, Jason Hill wrote: > > >>> create table foo (id, name) > >>> create table foo_config (id, foo_id, key, value) > > >>> insert into foo (1, 'name1') > >>> insert into foo (2, 'name2') > >>> insert into foo (3, 'name3') > > >>> insert into foo_config (1, 1, 'key1', 'val1') > >>> insert into foo_config (2, 1, 'key2', 'val2') > >>> insert into foo_config (3, 1, 'key3', 'val3') > >>> insert into foo_config (4, 2, 'key1', 'val1') > >>> insert into foo_config (5, 3, 'key2', 'val2') > > >>> How do I query for all foo's whose key1 = 'val1', in our case foo:1 > >>> and foo;2 will be listed here. How should I model / query for this, > >>> appreciate any pointers for the same. > > >>> -jh > > >>> -- > >>> 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 > >>> athttp://groups.google.com/group/datamapper?hl=en. > > > -- > > 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 > > athttp://groups.google.com/group/datamapper?hl=en.
-- 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.
