lib/dynamoid/persistence.rb in dynamoid-edge-1.1.1 vs lib/dynamoid/persistence.rb in dynamoid-edge-1.1.2
- old
+ new
@@ -14,10 +14,18 @@
alias :new_record? :new_record
module ClassMethods
def table_name
- @table_name ||= "#{Dynamoid::Config.namespace}_#{options[:name] || base_class.name.split('::').last.downcase.pluralize}"
+ table_base_name = options[:name] || base_class.name.split('::').last
+ .downcase.pluralize
+ table_prefix = if Dynamoid::Config.namespace.nil? then
+ ''
+ else
+ "#{Dynamoid::Config.namespace}_"
+ end
+
+ @table_name ||= "#{table_prefix}#{table_base_name}"
end
# Creates a table.
#
# @param [Hash] options options to pass for table creation