Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding class level method for searching individual keywords.
  • Loading branch information
Mark Coates committed Aug 1, 2011
1 parent 0865492 commit 7712da2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/clortho.rb
Expand Up @@ -25,6 +25,9 @@ def searchable(*args)

class_eval <<-CODE
class << self
def search_#{arg}_keywords_for(keyword)
true
end
end
CODE
end
Expand Down
4 changes: 4 additions & 0 deletions test/test_clortho.rb
Expand Up @@ -43,6 +43,10 @@ def setup
assert_equal "Hello world", @fridge.about_keywords
end

should 'have a search_about_keywords_for field' do
assert_equal Post.search_about_keywords_for('lipsum'), true
end

private
def save_posts
@posts.each{ |post| post.save }
Expand Down

0 comments on commit 7712da2

Please sign in to comment.