random_record 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mdown +31 -0
- data/lib/random_record/version.rb +2 -2
- metadata +2 -2
- data/README.rdoc +0 -23
data/README.mdown
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Getting Started
|
2
|
+
|
3
|
+
**Random Record** is an add on for ActiveRecord to give Rails 3 Models the abilities to access random records
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Random Record is released as a Ruby Gem. The gem is to be installed within a Ruby
|
8
|
+
on Rails 3 application. To install, simply add the following to your Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
# Gemfile
|
12
|
+
gem 'random_record'
|
13
|
+
```
|
14
|
+
|
15
|
+
After updating your bundle, you can use Random function within any ActiveRecord inherited model
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
For example you can do something like this in your controller (**app/controllers/users_controller.rb**), view or presenter
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
RANDOM_LIMIT = 5
|
23
|
+
|
24
|
+
def index
|
25
|
+
@users = User.random(RANDOM_LIMIT)
|
26
|
+
end
|
27
|
+
|
28
|
+
def show
|
29
|
+
@user = User.random
|
30
|
+
end
|
31
|
+
```
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module RandomRecord
|
2
|
-
VERSION = "0.0.
|
3
|
-
end
|
2
|
+
VERSION = "0.0.3"
|
3
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: random_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Rahul Trikha
|
@@ -35,7 +35,7 @@ extra_rdoc_files: []
|
|
35
35
|
files:
|
36
36
|
- .gitignore
|
37
37
|
- Gemfile
|
38
|
-
- README.
|
38
|
+
- README.mdown
|
39
39
|
- Rakefile
|
40
40
|
- lib/random_record.rb
|
41
41
|
- lib/random_record/version.rb
|
data/README.rdoc
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
= Random Record
|
2
|
-
|
3
|
-
Random Record is a add on for ActiveRecord to give models the abilities to access random records
|
4
|
-
|
5
|
-
== Getting Started
|
6
|
-
|
7
|
-
Random Record is released as a Ruby Gem. The gem is to be installed within a Ruby
|
8
|
-
on Rails 3 application. To install, simply add the following to your Gemfile:
|
9
|
-
|
10
|
-
# Gemfile
|
11
|
-
gem 'random_record'
|
12
|
-
|
13
|
-
After updating your bundle, you can use Random function within any ActiveRecord inherited model
|
14
|
-
|
15
|
-
# app/controllers/users_controller.rb
|
16
|
-
|
17
|
-
def index
|
18
|
-
@users = User.random(5)
|
19
|
-
end
|
20
|
-
|
21
|
-
def show
|
22
|
-
@user = User.random
|
23
|
-
end
|