Skip to content
This repository was archived by the owner on Jun 30, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ examples/*.html
*.log
.rvmrc
.rbenv-version
.idea/
tmp/
2 changes: 1 addition & 1 deletion lib/tire/model/persistence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def self.included(base)

['_score', '_type', '_index', '_version', 'sort', 'highlight', '_explanation'].each do |attr|
define_method("#{attr}=") { |value| @attributes ||= {}; @attributes[attr] = value }
define_method("#{attr}") { @attributes[attr] }
define_method("#{attr}") { @attributes.try(:[], attr) }
end

def self.search(*args, &block)
Expand Down
2 changes: 1 addition & 1 deletion lib/tire/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Tire
VERSION = "0.6.2"
VERSION = "0.6.2.1"

CHANGELOG =<<-END
IMPORTANT CHANGES LATELY:
Expand Down
4 changes: 4 additions & 0 deletions test/unit/model_persistence_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ class << a
assert_nothing_raised { PersistentArticle.new }
end

should "have getter methods for underscore-attributes of unsaved models" do
assert_nothing_raised { PersistentArticle.new._version }
end

should "have getter methods for attributes" do
assert_not_nil @article.title
assert_equal 'Test', @article.title
Expand Down