Exception: Ohm::Model::IndexNotFound
Overview
Raised when you try and do an Set#find operation and use a key which you did not define as an index.
class Post < Ohm::Model attribute :title end post = Post.create(:title => "Ohm") ex = nil begin Post.find(:title => "Ohm") rescue Exception => e ex = e end ex.kind_of?(Ohm::Model::IndexNotFound) # => true
To correct this problem, simply define a :title index in your class.
class Post < Ohm::Model attribute :title index :title end
Instance Method Summary (collapse)
-
- (IndexNotFound) initialize(att)
constructor
A new instance of IndexNotFound.
- - (Object) message
Constructor Details
- (IndexNotFound) initialize(att)
A new instance of IndexNotFound
1034 1035 1036 |
# File 'lib/ohm.rb', line 1034 def initialize(att) @att = att end |
Instance Method Details
- (Object) message
1038 1039 1040 |
# File 'lib/ohm.rb', line 1038 def "Index #{@att.inspect} not found." end |