#Explains itself!
def print_number
# Get the data
@option = Option.find_by_name('next_number')
# Put the value from the returned data into a local variable
# so we can convert it to an Integer.
integer_value = @option.value
integer_value = integer_value.to_i + 1
# Update the option value with the incremented value from above.
@option.value = integer_value
# Save the option so we can increment it again on the next function call
@option.save
# Return the new value
integer_value
end

I would like to do something like @option.value += 1, but I cannot do that. How can I refactor this to make it look better?

Thanks

Last edited by wesf90 (2012-03-12 20:02:41)

Remember to edit your topic title and add "[SOLVED]" if your question has been answered!