ploymorphic_wuid 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -46,6 +46,8 @@ end
46
46
 
47
47
  obj = Wuid.find(params[:wuid]).wuidable
48
48
 
49
+ now you can both pass in an id or an rand_token to get the corresponding object
50
+
49
51
  get an object's wuid:
50
52
 
51
53
  obj.wid
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -18,7 +18,7 @@ module PloymorphicModule
18
18
  module InstanceMethods
19
19
 
20
20
  def wid
21
- self.wuid.id rescue nil
21
+ self.wuid.rand_token rescue nil
22
22
  end
23
23
 
24
24
  def after_create
data/lib/wuid/wuid.rb CHANGED
@@ -24,14 +24,16 @@ class Wuid < ActiveRecord::Base
24
24
  return args.first if expects_array && args.first.empty?
25
25
  case args.size
26
26
  when 0
27
- raise RecordNotFound, "Couldn't find #{name} without an ID"
27
+ raise "Couldn't find #{name} without an ID"
28
28
  when 1
29
29
  if args[0].is_a?(Integer) || (args[0].is_a?(String) && args[0] =~ /^\d{1,}$/)
30
- super
30
+ raise "Don't support simple digest id any more"
31
+ #super
31
32
  else
32
33
  if args[0].is_a?(Array)
33
34
  if args[0].all?{|i| i.is_a?(Integer)} || args[0].all?{|i| i=~ /^\d{1,}$/}
34
- super
35
+ raise "Don't support simple digest id any more"
36
+ #super
35
37
  else
36
38
  origin_find(:all, :conditions => ["rand_token in (?)", args[0]])
37
39
  end
Binary file
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ploymorphic_wuid}
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["tim.teng"]
12
- s.date = %q{2010-06-23}
12
+ s.date = %q{2010-06-25}
13
13
  s.description = %q{ This is a gem to generate an unique id in your application world.}
14
14
  s.email = %q{tim.rubist@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  "lib/wuid/ploymorphic_module.rb",
27
27
  "lib/wuid/rand_gen.rb",
28
28
  "lib/wuid/wuid.rb",
29
- "pkg/ploymorphic_wuid-0.5.0.gem",
29
+ "pkg/ploymorphic_wuid-0.5.1.gem",
30
30
  "ploymorphic_wuid.gemspec",
31
31
  "test/helper.rb",
32
32
  "test/test_ploymorphic_wuid.rb"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 0
9
- version: 0.5.0
8
+ - 1
9
+ version: 0.5.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - tim.teng
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-23 00:00:00 +08:00
17
+ date: 2010-06-25 00:00:00 +08:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -37,7 +37,7 @@ files:
37
37
  - lib/wuid/ploymorphic_module.rb
38
38
  - lib/wuid/rand_gen.rb
39
39
  - lib/wuid/wuid.rb
40
- - pkg/ploymorphic_wuid-0.5.0.gem
40
+ - pkg/ploymorphic_wuid-0.5.1.gem
41
41
  - ploymorphic_wuid.gemspec
42
42
  - test/helper.rb
43
43
  - test/test_ploymorphic_wuid.rb
Binary file