Skip to content
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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 0.6.0
Copy link
Owner

@spilliton spilliton Sep 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only bump this number when there is a major change in the gem, will prolly just release this as 0.5.1 :)


* Adding support for Microsoft SQL Server

### 0.5.0

* Adding ```order_by_rand``` and ```order_by_rand_weighted``` scopes
Expand All @@ -14,4 +18,4 @@
### 0.3.0

* Added random_weighted() (thanks mceachen)
* Added random_by_id_shuffle() to fix issue with uniq in postgres and provide some options
* Added random_by_id_shuffle() to fix issue with uniq in postgres and provide some options
6 changes: 6 additions & 0 deletions lib/randumb/syntax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def random_for(opts)
random_for_sqlite(opts)
elsif adapter_name =~ /(postgres|postgis)/i
random_for_postgres(opts)
elsif adapter_name =~ /mssql/i
random_for_mssql(opts)
elsif adapter_name =~ /mysql/i
random_for_mysql(opts)
else
Expand Down Expand Up @@ -69,6 +71,10 @@ def random_for_postgres(opts)
"RANDOM()"
end

def random_for_mssql(opts)
"NEWID()"
end

def random_for_mysql(opts)
if seed = opts[:seed]
"RAND(#{seed.to_i})"
Expand Down
2 changes: 1 addition & 1 deletion lib/randumb/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Randumb
VERSION = "0.5.0"
VERSION = "0.6.0"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

end