Skip to content

Commit

Permalink
Added #to_gid_param and #to_sgid_param as short-cuts for to_gid.to_pa…
Browse files Browse the repository at this point in the history
…ram and to_sgid.to_param for convenience
  • Loading branch information
dhh committed Feb 5, 2015
1 parent 9c71bf8 commit 64fb44b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* Added #to_gid_param and #to_sgid_param as short-cuts for to_gid.to_param and to_sgid.to_param for convenience.

*DHH*

* Added support for Locator.locate_many and Locator.locate_many_signed to efficiently fetch many models.

*Tom Ward, DHH*
2 changes: 1 addition & 1 deletion globalid.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'globalid'
s.version = '0.3.1'
s.version = '0.3.2'
s.summary = 'Refer to any model with a URI: gid://app/class/id'
s.description = 'URIs for your models makes it easy to pass references around.'

Expand Down
8 changes: 8 additions & 0 deletions lib/global_id/identification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ def to_global_id
end
alias to_gid to_global_id

def to_gid_param
to_global_id.to_param
end

def to_signed_global_id(options = {})
SignedGlobalID.create(self, options)
end
alias to_sgid to_signed_global_id

def to_sgid_param(options = {})
to_signed_global_id(options).to_param
end
end
end

0 comments on commit 64fb44b

Please sign in to comment.