I hope this helps . Auto-increment values are not intended to be consecutive. They must be unique, that's all. If you try to decrement the auto-increment value on error, you'll create a race condition in your app. For example:
hop of those help? I'd recommend stuffing the HTML you parsed out of the XML into a "NSMutableString" object and then hunt through the mutable string object looking for the ranges of all substrings that match the pattern "font size=". Once you find those ranges, you should be able to get the font sizes and then put them into a "NSInteger" via something like [NSString integerValue] which you can then increment and put back into the mutable string object. Obviously there's some extra detail I'm not thinking too hard about, like how to replace a "9" in the mutable string with a "10" or to tell the difference between a font size of "10" and one that's "100". But at least this should be a good start for you.
it fixes the issue What I want to achieve is having a textbox with the value 0 or blank, and a user to be able to input a number. Then i want the two buttons (one + and one -) to increase and decrease the value of the textbox by 50 for each onclick.
This might help you I don't necessarily see the point of what you try to do, but still I'll try to answer your specific problen. First, we want to initialize the number of vacant cottages to 5, for this when you create the table you can put :
create_table "cottages", force: :cascade do |t|
t.integer "no_of_vacant_cottage", default: 5