Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- record = Post.new(:title => 'Yay', :body => 'This is some insert SQL')
- # easiest way to achieve this is by calling protected #arel_attributes_values (tested in
- # rails 3.2.13). the alternative is to build the entire insert statement using arel >_>
- record.class.arel_table.create_insert \
- .tap { |im| im.insert(record.send(:arel_attributes_values, false)) } \
- .to_sql
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement