Thanks Jon, How come you need to surround a word with % for like to work?
Is there a way of getting all the tag fields at once without having to find all the posts and then iterate through them? I was looking for a quick and easy tag system, but think I might have to consider a separate model for them.... thanks again, DAZ On Aug 26, 1:17 pm, Jonathan Stott <[email protected]> wrote: > On 26 August 2010 10:55, DAZ <[email protected]> wrote:> Hi, > > > I'm using the following property in a Post class > > > property :tags, String > > > This is a space separated list of tags for that post. > > What you want then is > > Post.all(:tags.like => "%ruby%"). Though note this will also pick up > posts like rubygem. > > > Also, is there a DataMapper function that could create a list of all > > the tags from all posts in a single call? > > You'd basically need to fetch all the tag fields, and then split and > count in the ruby process. To do it with queries, you'd need separate > tag models. > > Regards > Jon -- 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.
