Skip to content
This repository has been archived by the owner on Jun 30, 2018. It is now read-only.

Commit

Permalink
Updating readme and creating exceptions file
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricio committed Sep 9, 2012
1 parent 3498181 commit 20372f0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
12 changes: 6 additions & 6 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,13 @@ If `String` the text given is evaluated at the current instance (using `instance
If `Symbol` a method with the same name as the symbol is called at the current instance, as in:

```ruby
mapping do
indexes :id, :as => :some_other_id
mapping do
indexes :category, :as => :category_name
end

def category_name
self.category.name
end

def some_other_id
self.component.id
end
```

If `Proc`, the proc is evaluated against the current instance (using `instance_eval`), as in:
Expand Down
1 change: 1 addition & 0 deletions lib/tire.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# Ruby 1.8 compatibility
require 'tire/rubyext/ruby_1_8' if defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'

require 'tire/errors'
require 'tire/rubyext/hash'
require 'tire/rubyext/symbol'
require 'tire/utils'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module Tire
class InvalidAsOptionException < Exception

def initialize( value )
super("Unknown type for :as field, accepted types are `Symbol`, `String` and `Proc`s - #{value.class.name} - #{value.inspect}")
super("Unknown type for :as field, accepted types are `Symbol`, `String`, `lambda`s and `Proc`s - #{value.class.name} - #{value.inspect}")
end

end
end
end
2 changes: 0 additions & 2 deletions lib/tire/model/search.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'tire/invalid_as_option_exception'

module Tire
module Model

Expand Down
2 changes: 1 addition & 1 deletion test/models/active_record_models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class ActiveRecordNewsStory < ActiveRecord::Base

tire do
mapping do
indexes :id, :index => :not_analysed
indexes :id
indexes :title
indexes :content
indexes :author_name, :as => :author_name
Expand Down

0 comments on commit 20372f0

Please sign in to comment.