you are here: codestackercodes [RSS]Creating SQL inserts from Rails

Creating SQL inserts from Rails

cc = CourseEnrollmentEmailCcUser.new(id: 1, couse_enrollment_email_id: 1)

puts cc.class.arel_table.create_insert.tap { |im|
  im.insert(cc.send(:arel_attributes_with_values_for_create, cc.attribute_names)) 
}.to_sql

Comments