Project

faker_seed

0.0
No commit activity in last 3 years
No release in over 3 years
It's as easy as: rails g fake posts -n 50
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 0.1.0
~> 1.4.3
>= 4.1.1
>= 4.1.1
 Project Readme

faker_seed

faker_seed is the easiest way to generate random seed data for your Rails models, it automatically creates random data based on the tables column names, trying to guess the best faker generator to be used in each one, this allows you to generate any number of random records for any model without configuring anything.

Include on your Gemfile:

gem 'faker_seed'

Then, bundle install and run:

rails g fake MODEL

This will generate a random fake record for the desired model. To generate more fake records run:

rails g fake MODEL -n 50

It will generate 50 fake records on the database.

If it was too much, and you want to destroy 30, run:

rails d fake MODEL -n 30

The code will also generate fake records for any model related to the main model through a has_many association, and will choose a random record on the belongs_to associations that the model may have. Example: if you generate fake seed data to the model Post, and it has_many Photos, and belongs_to Category, some random Photos will be created too, and a random Category will be choosen to link the Post.

It's also already integrated with paperclip, so it will download a random image from placeimg.com to save to the record if it has a paperclip attachment.

That's it, nice coding (: