ToFixture
Add to_fixture
method to Active Record object.
Installation
Add this line to your application's Gemfile:
gem 'to_fixture'
And then execute:
$ bundle
Or install it yourself as:
$ gem install to_fixture
Usage
user = User.create!(name: 'to_fixture', email: '[email protected]')
puts user.to_fixture
# =>
# users_1:
# name: to_fixture
# email: [email protected]
If you want to specify a label, pass the label name as an argument.
puts user.to_fixture("label")
# =>
# label:
# name: to_fixture
# email: [email protected]
License
The gem is available as open source under the terms of the MIT License.