How to remove a column from the database and replace the column with a custom method so that I no need to change all the legacy code that is using the old column?
# Book.rb
# column available removed from the database
def available?
# add custom available method here
# will return true/false
end
The above code is fine and can be accessed with something like this, Book.first.available?
. The question here is how to not change the query statement Book.where(available: true)
but still get the same result? Is there a way to create a custom rails method and can be apply in query?