I have a model named "Carrier." In my controller, when I do a Carrier.create(data)
, I get this error:
OCIError: ORA-02289: sequence does not exist: select carriers_seq.nextval id from dual
This is my code in my controller:
class CarriersController < ActionController::Base
def index
#stuff
end
def update
@params["carriers"].each do |id, data|
#data["id"]
if Carrier.exists?(data["id"])
carrier = Carrier.find(data["id"])
carrier.update_attributes(data)
else
Carrier.create(data)
end
end
redirect_to( :action => "index" )
end
end
I've done some googling, and I found these two webpages about a solution:
http://niranjansarade.blogspot.com/2011/03/avoid-oracle-sequence-during.html
http://www.dixis.com/?p=127
Where should I be putting the code for the ActiveRecord? Should it be going in my model?
Is there another solution to my error?
I don't know about ruby but it surely has been configured or programmed to use the database sequence carriers_seq. (A sequence is sort of a number generator)
How about creating this sequence in the database? try to execute the following statement in Oracle SQL*Plus:
create sequence CARRIERS_SEQ;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With