lib/sugarcrm/module.rb in sugarcrm-0.9.8 vs lib/sugarcrm/module.rb in sugarcrm-0.9.9

- old
+ new

@@ -13,11 +13,15 @@ # I.e. a SugarCRM Module named Users will generate # a SugarCRM::User class. def initialize(name) @name = name @klass = name.classify - @table_name = name.tableize + unless custom_module? + @table_name = name.tableize + else + @table_name = @name + end @custom_table_name = resolve_custom_table_name @fields = {} @link_fields = {} @fields_registered = false self @@ -34,11 +38,14 @@ # Custom attributes are contained in a table named after the module, with a '_cstm' suffix. # The module's table name must be tableized for the modules that ship with SugarCRM. # For custom modules (created in the Studio), table name don't need to be tableized since # the name passed to the constructor is already tableized def resolve_custom_table_name - @custom_table_name = @table_name + "_cstm" - @custom_table_name = @name + "_cstm" if custom_module? + if custom_module? + @custom_table_name = @name + "_cstm" + else + @custom_table_name = @table_name + "_cstm" + end end # Returns the fields associated with the module def fields return @fields if fields_registered? \ No newline at end of file