0.02
No commit activity in last 3 years
No release in over 3 years
Sample functionality for Active Record.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Active Sample

Gem Version Build Status

Sample functionality for Active Record.

Usage

Don't use this for large set of data for now (See #1).

User.count # => 0
User.sample => nil

User.count # => 100
User.sample => #<User id: 42, ...>
User.sample(2) => #<ActiveRecord::Relation [#<User id: 1>, #<User id: 42>]>

User.count # => 100
User.sample(200) => #<ActiveRecord::Relation [All Users but shuffled]>

Installation

Add this line to your application's Gemfile:

gem "active_sample"

And then execute:

$ bundle

Or install it yourself as:

$ gem install active_sample

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/JuanitoFatas/active_sample.

License

The gem is available as open source under the terms of the Apache License 2.0.