Do as below using String#to_sym
method :
DB.from(tableName.to_sym)
Looking at the documentation of Sequel::Database#from
, it seems it accepts all arguments as symbols. Thus you need to convert the string object pointed by the local variable tableName
, to a symbol object.