I’ve created the following function, and for testing have hardcoded the
following values:
def addNewRow
@timesheet = Timesheet.find(:employee_id => ‘1’,
:cost_code_id => ‘14’,
:dept => ‘007’,
:ending_date => ‘2006-07-15’)
if @timesheet == nil
Timesheet.create(:employee_id => ‘1’,
:cost_code_id => ‘14’,
:dept => ‘007’,
:ending_date => ‘2006-07-15’)
end
redirect_to_index()
end
The create code does work, but I am trying to add the find to avoid
duplicates. What is the format to mimic the where clause of a query?
Thanks!