I need to insert a new record into an existing table in a databse. I tried both approaches below:
class UserDetail < ActiveRecord::Base
def self.add_new_user
new_user = UserDetail.new
new_user.first_name = 'Joe'
new_user.last_name = 'Smith'
new_user.user_id = 'TEST'
new_user.save
end
def self.add_new_user_2
UserDetail.create(user_id: 'TEST', first_name: 'Joe',
last_name: 'Smith')
end
However, both approaches give me the error below:
ActiveRecord::StatementInvalid: OCIError: ORA-00926:
missing VALUES keyword: INSERT INTO "USER_DETAIL" DEFAULT VALUES
What am I missing? Please share your solutions.
(Using Ruby 1.9.3, ActiveRecord 4.2.4)