This is My Error I'm using best in place and I want it to update my sample_qty column this table does not have an id column so I did a work around for it but even after doing that I keep getting this error.
ActiveRecord::StatementInvalid (OCIError: ORA-01830: date format picture ends before converting entire input string: SELECT "SAMPLE_QTY".* FROM "SAMPLE_QTY" WHERE "SAMPLE_QTY"."EMPLOYEE_ID" = 'JQIS' AND "SAMPLE_QTY"."TRANSACTION_DATE" = TO_DATE('2014-11-13 00:00:00 UTC','YYYY-MM-DD HH24:MI:SS') ORDER BY CREATE_DATE DESC): app/controllers/samples_controller.rb:31:in `update'
Rails 3.1.8 Oracle DB
This is my model
default_scope order("CREATE_DATE DESC")
set_table_name :sample_qty
set_primary_keys :employee_id, :create_date
attr_accessible :sample_qty, :create_date
belongs_to :labor
paginates_per 20
validates :transaction_date,
date: { after: Proc.new { Time.now },
before: Proc.new { Time.now + 1.day } }
def transaction_date=(new_date)
self[:transaction_date] = Date.strptime(new_date.to_s, "%m/%d/%Y")
end
def date=(new_date)
if new_date.blank?
self[:date] = nil
else
self[:date] = Date.strptime(new_date.to_s, "%m/%d/%Y")
end
end
def create_date=(new_date)
self[:create_date] = Date.strptime(new_date.to_s, "%m/%d/%Y")
end
end
This is my controller
def sample_qty
@samples = Samples.find(params[:employee_id, :sample_qty])
end
def edit
@samples = Samples.find(params[:employee_id])
end
def update
@employee_id = params[:id]
@samples.assign_attributes({:create_date => Time.now.strftime("%Y-%m-%d")})
@samples.update_attributes(params[:samples])
@samples.validates_datetime :create_date
respond_with_bip(@samples)
end
end