Skip to content

Commit

Permalink
Let Model#find work with integer model ids as well as hashids
Browse files Browse the repository at this point in the history
  • Loading branch information
jcypret committed Apr 13, 2015
1 parent 0b7967b commit 05faeef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog

## 0.1.1 (2015-04-12)

- Let `Model#find` work with integer model ids as well as hashids.

## 0.1.0 (2015-04-12)
Initial Release

- Initial Release
6 changes: 5 additions & 1 deletion lib/hashid/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ def decode_id(id)
end

def find(hashid)
super(decode_id(hashid))
if hashid.is_a? String
super decode_id(hashid)
else
super hashid
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/hashid/rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Hashid
module Rails
VERSION = '0.1'
VERSION = '0.1.1'
end
end

0 comments on commit 05faeef

Please sign in to comment.