From: Josh Cheek Date: 2010-02-16T15:33:03+09:00 Subject: Re: Find by association table --000e0cd139c4c0b991047fb1e7e5 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Feb 16, 2010 at 12:17 AM, Greg Ma wrote: > No i cannot do this because the parameter isnt a tag object but just a > string. > I guess i could try this > def find_students_by_tag(tag) > res = Tag.find_by_name(tag) > res.students unless res > end > -- > Posted via http://www.ruby-forum.com/. > > Have you looked at the acts_as_taggable plugin? http://juixe.com/techknow/index.php/2006/07/05/acts-as-taggable-plugin/ That page has an example posts = Post.find_tagged_with('tag1') Which looks like you should be able to say Student.find_tagged_with(tag) Rather than the method you are currently trying to create Student.find_students_by_tag(tag) (actually, if you were wanting to call it like that, then it should be defined "def self.find_students_by_tag" because it should be a method on the Student class rather than on some particular student) --000e0cd139c4c0b991047fb1e7e5--