Add the ability to dump an model object to a sql insert by including SqlDumper in the model and calling #to_sql.
Add this line to your application's Gemfile:
gem 'sql_dumper'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sql_dumper
class User < ActiveRecord::Base
include SqlDumper
end
class ActiveRecord::Base
include SqlDumper
end
User.new.to_sql
User.new.to_sql(excluded_columns: [:foo])
- Fork the repo
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request