Q:

How to add(increment) integer value like we do in other languages using ++(increment) operator in Ruby on Rails

I'm trying to add to integer value + 1 , but I get 'no implicit conversion of Integer into Array'
Here is my code:
@user_id = User.limit(1).order('created_at desc').pluck(:user_id).map(&:to_i)
@user_id = @user_id + 1

A:

'no implicit conversion of Integer into Array'

It's because .pluck() and .map() return an array.

@user_id + 1 => is trying to add an array(@user_id) and an integer(1).
Since 1 is an integer which should be cast to an array to get added to an array and ruby doesn't want to do it implicitly. 
Hence the error.

Why not this?

User.limit(1).order('created_at desc') will return last active record. If created_at is not tempered you can achieve the same simply by
@user_id = User.last.user_id + 1

