acts_as_random 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,5 @@
1
+ = Version 0.1.4
2
+ * More db agnostic
1
3
  = Version 0.1.3
2
4
  * Fix 4 homepage url
3
5
  = Version 0.1.2
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('acts_as_random', '0.1.3') do |p|
5
+ Echoe.new('acts_as_random', '0.1.4') do |p|
6
6
  p.description = "Gem allowing ActiveRecord models to have randomly generated primary keys - not autoincremented"
7
7
  p.url = "https://github.com/mensfeld/Acts-as-Sweepable"
8
8
  p.author = "Maciej Mensfeld"
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{acts_as_random}
5
- s.version = "0.1.3"
5
+ s.version = "0.1.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Maciej Mensfeld"]
9
9
  s.cert_chain = ["/home/mencio/.cert_keys/gem-public_cert.pem"]
10
- s.date = %q{2011-04-17}
10
+ s.date = %q{2011-04-23}
11
11
  s.description = %q{Gem allowing ActiveRecord models to have randomly generated primary keys - not autoincremented}
12
12
  s.email = %q{maciej@mensfeld.pl}
13
13
  s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.md", "lib/acts_as_random.rb"]
@@ -25,11 +25,17 @@ module Acts
25
25
 
26
26
  module ClassMethods
27
27
  def random(skip_cache = false)
28
+ if ActiveRecord::Base.connection.adapter_name == 'SQLite'
29
+ rand = "Random()"
30
+ else
31
+ rand = "Rand()"
32
+ end
33
+
28
34
  unless skip_cache
29
- order("RAND()").first
35
+ order(rand).first
30
36
  else
31
37
  uncached do
32
- order("RAND()").first
38
+ order(rand).first
33
39
  end
34
40
  end
35
41
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: acts_as_random
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.3
5
+ version: 0.1.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Maciej Mensfeld
@@ -31,7 +31,7 @@ cert_chain:
31
31
  BH3YFsdk
32
32
  -----END CERTIFICATE-----
33
33
 
34
- date: 2011-04-17 00:00:00 +02:00
34
+ date: 2011-04-23 00:00:00 +02:00
35
35
  default_executable:
36
36
  dependencies:
37
37
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file