Module: ClosureTree::ActiveRecordSupport
- Included in:
- Generators::MigrationGenerator, Support
- Defined in:
- lib/closure_tree/active_record_support.rb
Instance Method Summary collapse
Instance Method Details
#remove_prefix_and_suffix(table_name, model = ActiveRecord::Base) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/closure_tree/active_record_support.rb', line 7 def remove_prefix_and_suffix(table_name, model = ActiveRecord::Base) pre = model.table_name_prefix suff = model.table_name_suffix if table_name.start_with?(pre) && table_name.end_with?(suff) table_name[pre.size..-(suff.size + 1)] else table_name end end |